954,560 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Help with Stored Procedure

ok, here is the script I ran to create the stored procedure

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO




CREATE PROCEDURE [insertFunction] (@Id [int], @class [nvarchar], @type [nvarchar], @name [nvarchar]) AS 

declare @classID [int]
select @classID = tblClass.ID from tblClass where tblClass.Name = @class



INSERT INTO tblFunction
	([ID],[Name],[ReturnType],[Class])
VALUES 
	(@Id,@name,@type,@classID)
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO


but when I run it I keep getting
Cannot insert the value NULL into column 'Class', table 'documentation.dbo.tblFunction'; column does not allow nulls. INSERT fails.
The statement has been terminated.

when i run the procedure substituting values for the variables, it works fine.

Any ideas?

campkev
Posting Pro in Training
484 posts since Jul 2005
Reputation Points: 14
Solved Threads: 19
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You