[thelist] SQL syntax

Susan Wallace susanhw at webcastle.com
Fri Feb 1 16:51:01 CST 2002


This may be an overly simple question, but I've stared at this too long.

I am trying to setup a view in MS SQL Server that will give me all records
where the ExpDate field is equal to the last day of the current month.

For example,

WHERE dbo.Member_Info.ExpDate = '2/28/2002'

This is fine if I want to edit this by hand each month to get the last day
of the month, but what I would like to do is set it up so that the value
that ExpDate is equal to is always the last day of the current month.

My reference point is using Cold Fusion, but that's not relevant here,
other than to say:

If I were setting the ExpDate field to the last day of February, one year
from now, I would use this syntax
:
<CFSET ExpDate = "#Month(CheckDate)#" & "-" & "#DaysInMonth(CheckDate)#" &
"-" & "#Year(CheckDate)#">

What is the syntax for setting that up in a view on mssql??

The ExpDate field is a Date/Time type, this is a MS SQL 7 server.

Thanks for any suggestions!

Susan Wallace




More information about the thelist mailing list