
August 14th, 2008, 10:58 AM
|
|
Registered User
|
|
Join Date: Aug 2008
Posts: 1
Time spent in forums: 29 m 8 sec
Reputation Power: 0
|
|
|
Returning a string in a Store Procedure
Hey guys,
I'm written a store procedure that runs a simple query and i want to return that output of that query to the code that called the store procedure. The problem is that the query gets a string as it's result and i want to know how to return this?
Code:
CREATE PROCEDURE dbo.usp_ReleaseDeviceAfterCancel
@orderItemID INT
AS
DECLARE @SerialNum int
BEGIN TRANSACTION getSerialNum
set @SerialNum =(SELECT SerialNum
FROM tblInventory
WHERE inventoryID in (SELECT InventoryID
FROM tblOrderItems
WHERE orderItemID = @orderItemID))
COMMIT TRAN GetSerialNum
//@SerialNum is now a string, an example might be 1245-bkgb-0045
RETURN @SerialNum
GO
Anybody any ideas? thanks for the help
|