如何避免默认日期存储 [英] how to avoid default date store

查看:64
本文介绍了如何避免默认日期存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我很坚强,我需要一个帮助.
如何避免默认日期存储在数据库中.现在我正在使用3层体系结构.如果没有从日期选择器中选择任何日期,则需要将日期存储在数据库中为Null或为空.

但是现在日期存储为01/01/1900格式.列字段数据类型为datetime

Hi,
I am stanly.I need one help.
How to avoid default date store in database. Right now i am using 3-tier architecture.If am not selecting any date from the date picker i need store the date in database is Null or empty.

But now the date is storing 01/01/1900 format.The column field datatype is datetime

推荐答案

为表添加默认约束为

ALTER COLUMN列名SET DEFAULT null
Add a default constraint to your table as

ALTER COLUMN columnname SET DEFAULT null


这篇关于如何避免默认日期存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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