Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 insert null

Author  Topic 

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2011-11-09 : 03:52:44
Following an insert into a table, I see that the value of 0 in columns which were NOT included in the insert statement.
How can I make sure that such columns are populated with NULL instead of 0.
Is it just by placing NULL in the default property of the column?
Thanks

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-11-09 : 04:01:27
you might have a default value of 0 specify for that column or maybe insert trigger.

If you have a default value specified, just removed it. NULL is the default




KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-09 : 04:06:59
if you dont have default specified and still its getting 0, then there might be trigger which is doing this. then modify the trigger to populate NULL instead

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2011-11-09 : 04:34:51
Solved in SQL. Thank you
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-09 : 04:38:13
wc

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -