Showing posts with label compare time in sql. Show all posts
Showing posts with label compare time in sql. Show all posts

Wednesday, 15 January 2014

Compare Date,Time in Sql, Comapre date,Compare time in Sql | Pravin Prajapati


  Compare Date/Time with Currant Date/Time in Sql

SELECT COUNT(*)

FROM tablename

WHERE
--compare date here with current date.
 CONVERT(DATE, [dateTimeColumn]) = CONVERT(DATE, GETDATE())
--compare time here with current time
 AND CONVERT(TIME, [dateTimeColumn]) <= CONVERT(TIME, GETDATE())