March 30, 2010 at 10:12 am
Hi,
i have the following
declare @LowDate int
select @LowDate = cast(CONVERT(CHAR,DATEADD(month,-1,DATEADD(mm,DATEDIFF(mm, 0, GETDATE()),0)),112)-19000000 as int) -- First Day Of Last Month YYYMMDD
i want to compare @LowDate to a column that is smalldatetime:(
how am i suppose to convert this..can anyone please help..:ermm:
Thanks
March 30, 2010 at 10:42 am
hello everyone, i found the answer!!!
Just in case if anyone gets stuck with the same query
i converted the smalldatetime column in the same way the variable was converted!
cast(CONVERT(CHAR,DATEADD(d, -1,DATEADD(mm, DATEDIFF(m, 0, SMALLDATETIMECOLUMNNAME + 1,0)),112)-19000000 as int) = @LowDate
It worked!
any suggestions on this are welcome:-)
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply