根据the doc,SQL Server中日期的默认值是
1900-01-01 00:00:00
我能以任何方式调用默认值吗?比如像这样
select isnull(date_column, default(date_column))
from my_table
答案 0 :(得分:6)
也许:
SELECT DefaultDate = CAST(0 AS DATETIME)
如果你需要DATE
,你也可以投射它:
SELECT DefaultDate = CAST(CAST(0 AS DATETIME) AS DATE)
答案 1 :(得分:3)
select MinimumDate = cast(dateadd(d, 0, 0) as date)