3

According to the doc the default value of a date in SQL Server is

1900-01-01 00:00:00

Can I call the default value in any way? For instance like this

select isnull(date_column, default(date_column))
from my_table
4

2 回答 2

6

也许:

SELECT DefaultDate = CAST(0 AS DATETIME) 

sql-Fiddle

如果你需要一个DATE,你也可以投射它:

SELECT DefaultDate = CAST(CAST(0 AS DATETIME) AS DATE)

sql-fiddle

于 2013-09-10T13:01:06.533 回答
3
select MinimumDate = cast(dateadd(d, 0, 0) as date)
于 2013-09-10T13:02:33.327 回答