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!

Executing a SQL stored procedure with an output

Status
Not open for further replies.

vfpshe

Programmer
Jan 2, 2001
24
0
0
US
Hello,

Can someone help me on how to execute a stored procedure with an output? I am developing a client-server application and one of my stored procedure had an output with a data type of bit.

here's my stores procedure.


**************
CREATE PROCEDURE Select_Name
@cName VARCHAR(20),
@bExists BIT OUTPUT
AS
IF EXISTS(SELECT DISTINCT Name FROM customers
WHERE LTRIM(RTRIM(Name)) = LTRIM(RTRIM(@cName)))
SET @bExists = 1
ELSE
SET @bExists = 0
go
**************

how do i execute this using sqlexec?

I would appreciate any help.

Thanks.
 
You can either make it a string and EXEC(@SQLStringyoumade)
or use sqlexec but I think either way (I'm sure about the first way) your variable will be out of scope for the rest of the query batch. Shouldn't this be in the SQL Server forum? JHall
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top