By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,874 Members | 1,027 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,874 IT Pros & Developers. It's quick & easy.

Setting Defaults in an Insert Into command for SQL

P: 1
Hi,

I have an issue where I am using INSERT INTO a Customer table with 36 fields- I have information for 2 fields and the

INSERT INTO [Customer](
[No_],[Name])
VALUES ('q1234','EP')

I get an error message..

Msg 515, Level 16, State 2, Line 2
Cannot insert the value NULL into column 'Search Name', table 'Customer'; column does not allow nulls. INSERT fails.
the statement has been terminated.


Is there a way to default the other fields to SPACE or something other than NULL - without defining every field.

Thanks
Nov 13 '07 #1
Share this Question
Share on Google+
1 Reply


iburyak
Expert 100+
P: 1,017
Try this:

Expand|Select|Wrap|Line Numbers
  1. INSERT INTO [Customer]( 
  2. [No_],[Name],[Search Name])
  3. VALUES ('q1234','EP','') 
Or
you can set a default in table designer.

Good Luck.
Nov 13 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.