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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 Insert Null values
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

27 Posts

Posted - 07/25/2013 :  04:48:11  Show Profile  Reply with Quote

I'm trying to update to a table that contains almost 50 NOT NULL columns, but I only need to enter values in 8 fields. The front end application auto generates a space field ' ' to enter blank values into these empty columns. I'm trying to auto generate a script that will update the tables with the values that I need. Can I run some kind of loop that will enter a space ' ' into any column I leave blank? or do I need to enter this space manually?

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 07/25/2013 :  04:58:59  Show Profile  Reply with Quote
if they're NOT NULL fields what you can do is attach a default constraint on them to make default value as ''. then include only required columns in your update others will get '' as value by default. Once your update is over you may revert it to how it was before by changing default constraints

SQL Server MVP
Go to Top of Page

Premature Yak Congratulator

22864 Posts

Posted - 07/28/2013 :  09:36:49  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
Also note that passing space for some columns will be treated and stored differently. Refer this link


Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000