Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 SQLBase,我试图让系统的当前日期等于列的日期 (create_date)。
MySQL 代码将是:
Select * From Date D Where D.Create_date=CURDATE();
有人可以建议我在 SQLBase 中获取当前日期吗?
日期格式应该只包含日期(yyyy-MM-dd)而不是时间戳。
要获取当前日期而不是时间,您应该能够使用@DATEVALUE(@NOW).
@DATEVALUE(@NOW)
这应该会给你你想要的结果:
DECLARE @Temp TABLE ( Col1 NVARCHAR(1) ,Date date ) INSERT INTO @Temp VALUES ('a','2017-12-08') ,('b','2017-12-08') SELECT * FROM @Temp WHERE Date = CONVERT(date, getdate())