如何编写查询以获取今天的日期数据SQL server?
SQL server
select * from tbl_name where date = <Todays_date>
正确答案将取决于您的确切类型datecolumn。假设它是类型Date:
datecolumn
Date
select * from tbl_name where datecolumn = cast(getdate() as Date)
如果是DateTime:
DateTime
select * from tbl_name where cast(datecolumn as Date) = cast(getdate() as Date)