开发者

Inserting a null value into the database

Good Morning,

Say I have an insert statement:

Insert INTO tblTest (f开发者_运维百科ieldOne,FieldTwo,fieldThree) VALUES ('valueOne','valueTwo','null')

This statement doesn't seem to want to insert a null value into the database... I have also tried to insert the word "nothing".

Has anyone any ideas how to make this work? I am using SQL server 2005.


First of all, instead of 'null', try null (lose the quotes)

Then check that the fieldThree column on TblTest doesn't have any constraint prohibiting the use of null values...


Try

Insert INTO tblTest (fieldOne,FieldTwo,fieldThree) VALUES ('valueOne','valueTwo',NULL)

Check for fieldThree not to be NOT NULL.

If you're trying to INSERT 'NULL' string, then just check if fieldThree is varchar type.


Insert INTO tblTest (fieldOne,FieldTwo) VALUES ('valueOne','valueTwo').
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜