Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 14th, 2008, 10:58 AM
rugby_fan rugby_fan is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2008
Posts: 1 rugby_fan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft SQL Server > Returning a string in a Store Procedure


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT