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)
 Insert issues

Author  Topic 

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2004-08-16 : 12:40:20
Iam getting this error for an insert query and the table has a primary key sale_id and order_id is a field where nulls are not allowed and Iam passing an integer value

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

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-08-16 : 12:43:52
well...you're inserting a null somewhere... :)
show us your insert statement

Go with the flow & have fun! Else fight the flow :)
Go to Top of Page

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2004-08-16 : 13:06:22
INSERT INTO sales_details(
order_id, expense_money, daily_rent,
order_descrp,)

VALUES (
100,5000,600,NULL,

)

Here the primary key is sales_id (auto incremental key)and the order_id doesn't allow NULLs
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-08-16 : 13:10:29
Me thinks there is more to your query as there is a comma after the fourth column. Do you have a trigger on this table?

Tara
Go to Top of Page

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2004-08-16 : 13:21:03
Not in this table but the insert happens from a trigger in a different table
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-08-16 : 13:25:51
The trigger must be passing a NULL then as the query that you posted would work. Show us the trigger and the query that fired the trigger along with any data that we may need to help you out.

Tara
Go to Top of Page
   

- Advertisement -