Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Sun Foster
Aged Yak Warrior
515 Posts |
Posted - 2009-09-02 : 12:18:06
|
| I want to learn store procedure but I still do not know how to use output parameters in a store procedure.For example, there is one store procedure as I copied from a book:create proc ytd_sales@title varchar(80), @ytd_sales int outputas select @ytd_sales=ytd_salesfrom titleswhere title = @titlereturnHow to use the result from this store procedure for another store procedure? |
|
|
Ifor
Aged Yak Warrior
700 Posts |
Posted - 2009-09-02 : 12:43:26
|
| [code]SET QUOTED_IDENTIFIER, ANSI_NULLS ON GOCREATE PROCEDURE dbo.ytd_sales @title varchar(80) ,@ytd_sales int OUTPUTASSET NOCOUNT ON-- ensure an error if title is not unique and NULL if no title.SET @ytd_sales =( SELECT ytd_sales FROM titles WHERE title = @title)GODECLARE @sales intEXEC dbo.ytd_sales 'Your Title', @sales OUTPUTSELECT @salesEXEC dbo.AnotherProc @sales[/code] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-09-02 : 12:59:10
|
| also seehttp://www.sqlteam.com/article/stored-procedures-returning-data |
 |
|
|
|
|
|