SQL Server日期时间数据类型列空白值 [英] Sql server datetime datatype column blank value

查看:99
本文介绍了SQL Server日期时间数据类型列空白值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在SQL Server的DATETIME数据类型列中放入空白值


空白值表示完全空白,不为零.

How to put blank value to a DATETIME datatype column in sql server


blank value means,full blank,not zero

推荐答案

您使用关键字NULL添加未定义的值.

例如:
You use the keyword NULL to add an undefined value.

For example:
INSERT INTO YourTable (SomeDateTimeField) VALUES (NULL)



还请记住,始终使用IS NULL或IS NOT NULL运算符查询NULL,因为它永远不会等于任何值.

如果从.Net应用程序中识别出此内容,则可以使用System.DBNull.Value作为适当的参数.

问候,

mika



Also remember that NULL is always queried using IS NULL or IS NOT NULL operators since it''s never equal to anything.

If your dong this from .Net application you use System.DBNull.Value for the appropriate parameter.

Regards,

mika


唯一的方法是在字段定义m上设置"allow null".然后,您可以为其分配DBNull值.

否则,日期时间值是数字:您不能为其分配空格,而只能为数字分配空格.
The only way you can do that is if you have set "allow null" on the field definitionm. You can then assign a DBNull value to it.

Otherwise, a datetime value is numeric: you cannot assign a blank to it, any more than you can assigne a blank to a number.


这篇关于SQL Server日期时间数据类型列空白值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆