SQL Server Datetime类型为NULL不能用ISNULL(datetime,' ')来判断,会导致1900-01-01

select top 10 
--(case when zb.Order_CreatedOn is null then '' when zb.Order_CreatedOn<>'1900-01-01' then zb.Order_CreatedOn end)  as Order_CreatedOn,*--datetime类型不能转成'',如果转成'',返回给程序就是1900-01-01,''这种空字符串默认就会返回1900-01-01,所以不用在SQL里面转换,在程序里面用DBNUll.value来判断即可
--isnull(zb.Order_CreatedOn,''),*
zb.Order_CreatedOn,*
from dbo.GKOrder ck
left join dbo.ZBOrder zb on ck.OrderID=zb.Order_TransactionID

 

posted @ 2018-06-21 15:33  o李一波o  阅读(862)  评论(0编辑  收藏  举报