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
 General SQL Server Forums
 New to SQL Server Programming
 SQL No Input requested

Author  Topic 

sanj
Starting Member

22 Posts

Posted - 2010-09-21 : 17:00:08
Hi,

I creating a stored procedure to first check if a value DOES NOT Exist, if so create an insert but on executing I'm not see a request for the parameters?


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[NewSystem]
AS

Declare @ClassID int,
@ASystem nvarchar(150),
@ASubSystem nvarchar(150)

If Not Exists (Select ClassID From tbl_Systems Where System = @ASystem and SubSystem = @ASubSystem)

insert into tbl_systems
(ClassID, System, ASubSystem)
Values
(@ClassID, @ASystem, @ASubSystem)

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-21 : 17:02:59
You haven't defined them as input parameters.

CREATE PROC SomeProc (input parameters go here)
AS
...

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

sanj
Starting Member

22 Posts

Posted - 2010-09-21 : 17:11:15
Thanks Tara for pointing that out!
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-21 : 17:14:04
You're welcome, glad to help.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -