SQL转换datetime [英] SQL cast datetime
本文介绍了SQL转换datetime的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在SQL Server 2005中,为什么:
In SQL Server 2005, why does:
PRINT Cast(''AS datetime)
显示:
Jan 1 1900 12:00 AM
Jan 1 1900 12:00AM
我认为应该是 null
?
推荐答案
空字符串被转换为 0
,后来被转换为时代日期。
The empty string is casted to 0
which is later casted to the era date.
不同于 Oracle
, SQL Server
区分 NULL
和一个空字符串。
Unlike Oracle
, SQL Server
distinguishes between NULL
and an empty string.
这篇关于SQL转换datetime的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文