开发者

Date datatype for SQL Server 2005

I am using SQL Server 2005 Express Edition. I want to store date of birth in a table, which datatype should I开发者_开发问答 use for that?

Datetime provides time also with the date.

Is there any way in SQL Server 2005 to store only date?


Use smalldatetime (4 bytes storage) and add a check constraint. Do not use char or such.

The CHECK CONSTRAINT would be this, based on this question Best approach to remove time part of datetime in SQL Server

DOBCol = DATEADD(day, DATEDIFF(day, 0, DOBCol), 0)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜