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 2000 Forums
 Transact-SQL (2000)
 using default values

Author  Topic 

csphard
Posting Yak Master

113 Posts

Posted - 2002-10-10 : 13:57:25
I've set a default value on a field that does not allow null values.

I thought since it had a default value that i did not have to include
it in the insert statment. However i got the following message.

Cannot insert the value NULL into column 'state', table 'evaluations.dbo.profile'; column does not allow nulls. INSERT fails.
The statement has been terminated.

WHY?

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-10-10 : 14:03:45
Can you post the INSERT statement that's causing the error, and the exact table structure?

Go to Top of Page

csphard
Posting Yak Master

113 Posts

Posted - 2002-10-10 : 14:09:05
I think i answered my question. I did a dumm thing. I did not save my changes to the table.

Thanks.
INSERT INTO profile
( empid,
lname,
fname,
phoneno,
pay_location,
address,
city,
-- state,
zipcode,
psword,
secure_Level,
date_added,
bureau,
division,
sect) VALUES
('000020',
'22bryant',
'kobe',
1231231234,
'B2',
'2319 e 108 street',
'watts',
-- 'CA',
123456789012345,
'password',
00,
NULL,
726,
372,
277)

Go to Top of Page
   

- Advertisement -