当我在SQL Server中将列之一更改为不为空时,它会给出错误消息,如thie [英] when i change one of my column to not null in sql server it gives error message like thie

查看:163
本文介绍了当我在SQL Server中将列之一更改为不为空时,它会给出错误消息,如thie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

第515条消息,第2级,第2行,第1行
无法将值NULL插入表"CaseMS.dbo.DesignFileDiary"的"PICCodeID"列中;列不允许为空. UPDATE失败.
该语句已终止.

Msg 515, Level 16, State 2, Line 1
Cannot insert the value NULL into column ''PICCodeID'', table ''CaseMS.dbo.DesignFileDiary''; column does not allow nulls. UPDATE fails.
The statement has been terminated.

推荐答案

就像消息说不允许您将空值插入不允许的列中一样.

如果要执行此操作,请更改表并将列设置为允许空值.
Like the message said you are not allowed to insert null values into columns which don''t allow it.

If you want to do this alter the table and set the column to allow nulls.


将列更改为非空值之前,请检查该列中的任何空值.如果u在该列中找到null,则将其更新为某个值,然后将其设置为非null..
before you change column to not null, check any nulls in that column. If u find nulls in that column then updated to some value then set as not null..


最有可能的是,列PICCodeID包含NULL值,并且您正在尝试使列NOT NULL ,
在将其设为NOT NULL列之前,应先从该列中删除NULL值.
Most Probably The Column PICCodeID is containing a NULL value and you are trying to make the Column NOT NULL,
You should remove NULL value(s) from the column before making it a NOT NULL column.


这篇关于当我在SQL Server中将列之一更改为不为空时,它会给出错误消息,如thie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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