View Single Post
  #1 (permalink)  
Old March 24th, 2006, 10:21 PM
Bob Bedell Bob Bedell is offline
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default Output Parameters

Hello,

How do I call the following proc from Query Analyzer? Something like:

EXEC procOutGetCustomer 'ALFKI', ?, ?, ?

The proc is:

CREATE PROCEDURE procOutGetCustomer(
    @CustomerID nchar(5),
    @CompanyName nvarchar(40) OUTPUT,
    @ContactName nvarchar(30) OUTPUT,
    @ContactTitle nvarchar(30) OUTPUT)
AS SELECT
    @CompanyName = CompanyName,
    @ContactName = ContactName,
    @ContactTitle = ContactTitle
FROM
    Customers
WHERE
    CustomerID = @CustomerID
IF @@ROWCOUNT = 1
    RETURN 0
ELSE
    RETURN -1;

Thanks,

Bob



Reply With Quote