Posted By

kidmizere on 02/28/14


Tagged

datetoday


Versions (?)

MSSQL where date=today


 / Published in: SQL
 

This is the best method for querying a table to get data where a date column needs to equal today:

  1. -- edit tbl.datecolumn to reflect required column
  2.  
  3. WHERE tbl.datecolumn >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0) AND tbl.datecolumn < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1)

Report this snippet  

You need to login to post a comment.