SELECT *
FROM dbo.March2010 A
WHERE CAST(A.Date AS Date) >= '2017-03-22';
SELECT *
FROM dbo.March2010 A
WHERE CAST(A.Date AS Datetime) >= '2017-03-22 06:49:53.840';
日期格式对我没有问题(Mydate的数据类型是datetime): Where Mydate>'10/25/2021'或Where Mydate>'2021-10-25'
但如果加上时间,以上答案就不适用了。
下面是我所做的: where cast(Mydate as time)>'22:00:00'
如果您的查询需要一个日期,请添加日期,例如: where cast(Mydate as time)>'22:00:00' and Mydate='10/25/2021' < / p >
SELECT *
FROM dbo.March2010 A
WHERE A.Date >= '2010-04-01';
SELECT *
FROM dbo.March2010 A
WHERE A.Date >= CAST('2010-04-01' as Date);
SELECT *
FROM dbo.March2010 A
WHERE A.Date >= Convert(datetime, '2010-04-01' )