Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error on calling SP with output parameter 1

Status
Not open for further replies.

hrhadin

Programmer
Oct 7, 2003
16
0
0
US
I have a simple sp:

create procedure [dbo].[sp_GetClinicLocation]
@cCID char(5),
@cLocation varchar(50) output
AS
BEGIN
SELECT @cLocation = cLocation
FROM AC
WHERE cClinic = @cCID
END

I'm trying to call the procedure as such:

declare @Test varchar(50)
exec sp_GetClinicLocation '22401',@Test = @cLocation
select @Test

I'm receiving the error message: Must declare the scalar variable @cLocation

Anybody know where I'm going wrong. I'm a stored procedure beginner.
 
Code:
declare @Test varchar(50)
exec sp_GetClinicLocation '22401',@cLocation = @Test OUTPUT
select @Test

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
MVP VFP
 
or
Code:
declare @Test varchar(50)
exec sp_GetClinicLocation @cCID = '22401',
                          @cLocation = @Test OUTPUT
select @Test

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
MVP VFP
 
Try...

Code:
declare @Test varchar(50)
exec sp_GetClinicLocation '22401',@Test [!]output[/!]
select @Test



-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top