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 |
|
verybrightstar
Starting Member
16 Posts |
Posted - 2005-05-24 : 07:48:50
|
| Hi all ,as for i know sp_executesql can return one parameter output , how can i return two parameter output using one sp_executesql statementerror throws show must declare the Server: Msg 137, Level 15, State 1, Line 1Must declare the variable '@TotalPrice'.CREATE PROCEDURE [dbo].[SPTest] ASdeclare @SQL as nvarchar(4000)declare @TotalSold as intdeclare @TotalPrice as floatset @TotalSold=0set @TotalPrice=0DECLARE @Count intset @SQL = N'select @Count = COUNT(*) , @TotalPrice=SUM(Price) from dbo.tblTransItems'execute sp_executesql @SQL, N'@Count int OUT', @Count OUT , N'@TotalPrice float OUT' , @TotalPrice OUTprint @Countprint @TotalPricekt |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2005-05-24 : 08:06:50
|
| execute sp_executesql @SQL,N'@Count int OUT, @TotalPrice float OUT', @Count OUT, @TotalPrice OUT==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|
|
|