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.
Author |
Topic |
monik
Starting Member
4 Posts |
Posted - 2005-07-06 : 12:15:36
|
Here is my code:DECLARE @ParentID INTDECLARE @title NVARCHAR(64)IF NOT EXISTS ( SELECT ReportItemID FROM ReportItem WHERE (Caption = N'Transaction Reports'))BEGININSERT INTO dbo.ReportItem (Caption,Description,FileName,ParentID,FactorySet) VALUES (N'Transaction Reports', -- CaptionN'', -- DescriptionN'', -- FileName0, -- ParentID0 -- FactorySet)SET @ParentID = @@IDENTITYSET @title = N'All Access Attempts'INSERT INTO dbo.ReportItem (Caption,Description,FileName,ParentID,FactorySet)VALUES (@title, -- CaptionN'This report shows all access attempts', -- DescriptionN'TrnHis27.rpt', -- FileName@ParentID, -- ParentID0 -- FactorySet)ENDGO--------------------------------------------------------------------Here is the error:Server: Msg 515, Level 16, State 2, Line 32Cannot insert the value NULL into column 'ParentID', table 'GeoffreySQL.dbo.ReportItem'; column does not allow nulls. INSERT fails.The statement has been terminated.for some reason the variable is not getting the value, why is this. it only happens with 7.0 |
|
Kristen
Test
22859 Posts |
Posted - 2005-07-06 : 13:14:27
|
Duplicate of http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=52023 |
|
|
|
|
|
|
|