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
 OUTPUT parameter required?

Author  Topic 

dthatcher
Starting Member

2 Posts

Posted - 2012-10-11 : 08:53:09
I have created the following stored procedure:

USE Northwind
GO
CREATE PROC spCheckContact
@cst nchar(5),
@TitleName varchar(10) OUTPUT
AS
{remainder of my sproc; deleted to prevent plagiarism}

When I attempted to run it like this:

EXEC spCheckContact 'ALFKI'

I get this error:

Msg 201, Level 16, State 4, Procedure spCheckContact, Line 0
Procedure or function 'spCheckContact' expects parameter '@TitleName', which was not supplied.


But @TitleName is specified as an OUTPUT parameter! How can I fix this?

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2012-10-11 : 09:18:46

Try it.........

DECLARE @tit_name varchar(30)
EXEC spCheckContact 'ALFKI', @tit_name OUTPUT
PRINT @tit_name

--
Chandu
Go to Top of Page

dthatcher
Starting Member

2 Posts

Posted - 2012-10-11 : 09:34:56
Ah... so the output variable has to be supplied at execution. Thank you, that worked!
Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2012-10-11 : 09:36:07
quote:
Originally posted by dthatcher

Ah... so the output variable has to be supplied at execution. Thank you, that worked!



Welcome

--
Chandu
Go to Top of Page
   

- Advertisement -