Thursday, October 15, 2009

Only Date Part to GetDate() function in SQL Server

Problem:
I want to getdate() function to compare datetime field.  Date part of both field (2009-10-15 ) but not equal. 

SELECT getdate(),* from GUNLUK_GELENLER WHERE Per_ZeitStatusDatum = getdate()
--No Result

SOLUTION:

SELECT getdate(),* from GUNLUK_GELENLER WHERE
CONVERT(VARCHAR(10),Per_ZeitStatusDatum,111) =
CONVERT(VARCHAR(10),GETDATE(),111)