正确答案将取决于您的确切类型datecolumn
。假设它是类型Date
:
select * from tbl_name
where datecolumn = cast(getdate() as Date)
如果是DateTime
:
select * from tbl_name
where cast(datecolumn as Date) = cast(getdate() as Date)
如何在SQL Server中获取当前/今天的日期数据
正确答案将取决于您的确切类型datecolumn
。假设它是类型Date
:
select * from tbl_name
where datecolumn = cast(getdate() as Date)
如果是DateTime
:
select * from tbl_name
where cast(datecolumn as Date) = cast(getdate() as Date)