May 29, 2009 at 9:15 am
Hi, I am capturing results from "1st day of the month" to "last day of the month".
How can I replace function to avoid put date manulally.
--Script which need to be updated to run in SQL-Server 6.5 version
Select * from depend
where effdate >='2009-05-01' --1st of current month
and effdate< '2009-06-01' --1st of next month
--I have script for SQL-Server 2000 but not able to run SQL-Server 6.5 and getting error of 'Operand type clash: int is incompatible with datetime'
--Script is fine in SQL-server 2000
SELECT * FROM depend
WHERE EffDate>=DATEADD(month,DATEDIFF(month,0,GETDATE()),0)
AND EffDate
May 29, 2009 at 4:03 pm
You appear to be missing part of the query after the AND. What's the full query look like?
--Jeff Moden
Change is inevitable... Change for the better is not.
May 29, 2009 at 4:04 pm
Oh, yeah.... the other thing to try is changing the "0" date to '1900-01-01' everywhere.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply