Colin, there's no other term for it.  You're a bloody genius and a
gentleman.   Thanks!

Cheers,
Mike Kear
Windsor, NSW, Australia
AFP WebWorks


-----Original Message-----
From: Colin Robinson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 02, 2001 11:59 PM
To: SQL
Subject: RE: Date Selection SQL - help

Sorry Mike,

Try :

SELECT *
FROM date
WHERE DATEPART(wk,cast(rtrim(cast(d_Month as char(2)))+'/'+rtrim(cast(d_Day
as
char(2)))+'/'+cast(d_Year as char(4)) as datetime))= DATEPART(wk,getdate())

> -----Original Message-----
> From: Mike Kear [mailto:[EMAIL PROTECTED]]
> Sent: 02 October 2001 14:28
> To: SQL
> Subject: RE: Date Selection SQL - help
>
>
> Thank you Colin,
>
> Unfortunately, SQLServer7 doesn't like that.  I can see where
> you're coming
> from and I thought it would work ok.    But it objects to the
> '/' part.
>
> I get the following error:
> [quote]
> Syntax error converting the varchar value '/' to a column of
> data type int.
> [/quote]
>
> Any suggestions as to where to go now?
>
> Cheers,
> Mike Kear
> Windsor, NSW, Australia
> AFP WebWorks
>
>
> -----Original Message-----
> From: Colin Robinson [mailto:[EMAIL PROTECTED]]
> I think something along the lines of the sql below will work.
>
> SELECT *
> FROM anniversaries
> WHERE DATEPART(wk,CAST(Month+'/'+Day+'/'+Year AS datetime))=
> DATEPART(wk,getdate())
>
> I have not run it so i'm not sure the syntax is spot on !
>
> > -----Original Message-----
> > From: Mike Kear [mailto:[EMAIL PROTECTED]]
> > Sent: 02 October 2001 08:12
> > To: SQL
> > Subject: Date Selection SQL - help
> >
> >
> >  I have a birthdays and anniversaries table, and I want to be
> > able to select
> > the birthdays that occur in the current week.  But I don't
> > know how to write
> > the SELECT statement.  Can anyone help?
> >
> >
> > The birthday is stored in the table with Day and Month fields
> > as integers.
> > It's easy enough in the middle of the month, but how do I
> > select for this
> > week, when there is a month end boundary in the week?
> >
> >
> >
> > The table structure I have is:
> >
> > CREATE TABLE [anniversaries] (
> >       [annivID] [int] IDENTITY (1, 1) NOT NULL ,
> >       [Day] [int] NULL ,
> >       [Month] [int] NULL ,
> >       [name]  [varchar] (255) NULL
> >
> > )
> >
> >
> >
> > Cheers,
> > Mike Kear
> > Windsor, NSW, Australia
> > AFP WebWorks
> >
> >
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to