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
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to