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:05:35
|
| Here is my code:DECLARE @ParentID INTDECLARE @title NVARCHAR(64)IF NOT EXISTS ( SELECT ReportItemID FROM ReportItem WHERE (Caption = N'Transaction Reports'))BEGIN INSERT INTO dbo.ReportItem ( Caption, Description, FileName, ParentID, FactorySet ) VALUES ( N'Transaction Reports', -- Caption N'', -- Description N'', -- FileName 0, -- ParentID 0 -- FactorySet ) SET @ParentID = @@IDENTITY SET @title = N'All Access Attempts' INSERT INTO dbo.ReportItem ( Caption, Description, FileName, ParentID, FactorySet ) VALUES ( @title, -- Caption N'This report shows all access attempts', -- Description N'TrnHis27.rpt', -- FileName @ParentID, -- ParentID 0 -- 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 sql 7.0 |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-07-06 : 13:23:54
|
| Duplicate of http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=52023 |
 |
|
|
|
|
|
|
|