?
Solved

Stroed Procedure not building

Posted on 2011-09-13
5
Medium Priority
?
257 Views
Last Modified: 2012-05-12
I have created a stored proc to update one filed in my DB and all the others work just not this one anyone have any ideas?


set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
Create PROCEDURE [dbo].[P_sp_SubmittedDateIRBUser]
	/*
	(
	@parameter1 int = 5,
	@parameter2 datatype OUTPUT
	)
	*/

ID int,
IRBSubmittedDate nvarchar(50)

AS
	/* SET NOCOUNT ON */
	UPDATE tbl_info
	SET IRBSubmittedDate = @IRBSubmittedDate

	WHERE ID = @ID
	RETURN
Msg 102, Level 15, State 1, Procedure P_sp_SubmittedDateIRBUser, Line 9
Incorrect syntax near 'ID'.
Msg 137, Level 15, State 2, Procedure P_sp_SubmittedDateIRBUser, Line 15
Must declare the scalar variable "@IRBSubmittedDate".

Open in new window

0
Comment
Question by:HawaiiDragon
5 Comments
 
LVL 5

Accepted Solution

by:
zvytas earned 668 total points
ID: 36530024
Try the following:

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
Create PROCEDURE [dbo].[P_sp_SubmittedDateIRBUser]
      /*
      (
      @parameter1 int = 5,
      @parameter2 datatype OUTPUT
      )
      */
(
@ID int,
@IRBSubmittedDate nvarchar(50)
)
AS
      /* SET NOCOUNT ON */
      UPDATE tbl_info
      SET IRBSubmittedDate = @IRBSubmittedDate

      WHERE ID = @ID
      RETURN
0
 
LVL 13

Assisted Solution

by:Philip Pinnell
Philip Pinnell earned 668 total points
ID: 36530040
your parms should have @

@ID int,
@IRBSubmittedDate nvarchar(50)

0
 
LVL 29

Assisted Solution

by:Paul Jackson
Paul Jackson earned 664 total points
ID: 36530059
I assume that the below 2 lines are parameters being passed into the stored procedure :

ID int,
IRBSubmittedDate nvarchar(50)

you need to put some brackets round them and put an @ symbol in front.
(
@ID int,
@IRBSubmittedDate nvarchar(50)
)
0
 

Author Closing Comment

by:HawaiiDragon
ID: 36530152
Man what a "duh" moment for me... guess thats what 2 hours of sleep a night can do to you. Thanx guys!!!
0
 
LVL 13

Expert Comment

by:Philip Pinnell
ID: 36530317
Thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Integration Management Part 2
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question