how to get current/Todays date data in sql server

krishna mohan picture krishna mohan · Mar 5, 2015 · Viewed 83.7k times · Source

how to write query to get today's date data in SQL server ?

select * from tbl_name where date = <Todays_date>

Answer

Mitch Wheat picture Mitch Wheat · Mar 5, 2015

The correct answer will depend of the exact type of your datecolumn. Assuming it is of type Date :

select * from tbl_name 
where datecolumn = cast(getdate() as Date)

If it is DateTime:

select * from tbl_name 
where cast(datecolumn as Date) = cast(getdate() as Date)