var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Date in tsql
I wanna retrieve records for today. But not working?
select freedate from holidays where freedate = (getdate())
how can I retrieve for specific date?
getdate() will return the current time such as : 2010-08-21 13:28:29.570
whereas if you want all records for today : you could do something like :
select freedate from holidays where CONVERT(VARCHAR(8),freedate,1) = CONVERT(VARCHAR(8), GETDATE(), 1)
do not apply any function to the table column, as this will prevent an index from optimizing the query, you will get a table scan
instead, do it this way --
WHERE freedate >= DATEADD(D,DATEDIFF(D,0,GETDATE()),0)
AND freedate < DATEADD(D,DATEDIFF(D,0,GETDATE()),1)