将空值插入时间类型 [英] inserting a null value to Time type

查看:102
本文介绍了将空值插入时间类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


我在表上有一个时间类型列。我把它设置为没有。当我输入空值时,该列存储00:00:00值。


如何只存储空值,以便用户可以选择不输入任何时间并且不显示记录显示的时间?

实际上,对我来说重要的部分是没有显示任何价值,我真的不介意它存储的是什么,但我不想放弃存储midmidnight值的选项。



谢谢,

Hello,

I have a Time type column on a table. I have set it to ¨no null¨. When I enter a null value the column stores a 00:00:00 value.

How can I do to store just an empty value, so that the user have the choice to don''t enter any time and display no time when the record is displayed?
Actually, the important part for me is displaying no value, I really don''t mind what it is stored, but I dont want to loose the option of storing a ¨midnight value.


thanks,

推荐答案


您好,


我在表上有一个Time类型列。我把它设置为没有。当我输入空值时,该列存储00:00:00值。


如何只存储空值,以便用户可以选择不输入任何时间并且不显示记录显示的时间?

实际上,对我来说重要的部分是没有显示任何价值,我真的不介意它存储的是什么,但我不想放弃存储midmidnight值的选项。



谢谢,
Hello,

I have a Time type column on a table. I have set it to ¨no null¨. When I enter a null value the column stores a 00:00:00 value.

How can I do to store just an empty value, so that the user have the choice to don''t enter any time and display no time when the record is displayed?
Actually, the important part for me is displaying no value, I really don''t mind what it is stored, but I dont want to loose the option of storing a ¨midnight value.


thanks,



你不能将NULL存储到NOT NULL列。而且由于它的TIME数据类型,你也不能存储像White Spaces这样的东西。您还需要使列接受NULL值。

You cannot store NULL in to NOT NULL column. And Since its TIME datatype, you cannot store something like White Spaces as well. You need to make the column to accept NULL values as well.


注意:在db中, null 值与 0 <不相同/ b>(零)值!


Null表示没有值,其中0是实数值。午夜是零值00:00:00而不是空值。在您的时间字段中允许空值表示您希望时间字段中没有值的选项。


Ronald
Be careful: in a db a null value is not identical to a 0 (zero) value!

Null indicates the absence of a value, where 0 is a real value. Midnight is a zero value 00:00:00 and not a null value. Allowing a null in your time field indicates that you want the option of no value in your time field.

Ronald



您不能将NULL存储到NOT NULL列中。而且由于它的TIME数据类型,你也不能存储像White Spaces这样的东西。您还需要使列接受NULL值。
You cannot store NULL in to NOT NULL column. And Since its TIME datatype, you cannot store something like White Spaces as well. You need to make the column to accept NULL values as well.



好​​吧,我让colum接受NULL值,然后呢?

必须有一些方法来实现这个目的(不存储,但是,当用户填写时间表时,如果没有时间数据类型,则为时间数据类型消除空值,例如

Ok, I have make the colum accept NULL values, and then?
There must be some way for achieving this(not storing, but dislaying a null value for a Time datatype when the user has fill in a time form with ¨no time fot this trip¨ for example)

这篇关于将空值插入时间类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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