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 |
|
jblanco2281
Starting Member
4 Posts |
Posted - 2010-09-10 : 15:18:34
|
| I am writing a stored procedure in which I call another one that returns me ONE row of a table... How can I use the field values of that returned row in my Stored Procedure?? I have to use a cursor or can I avoid the cursor because I have to run this SP about 50 times per sec so I have read that cursors can be very resource consuming...Thanks for your help... |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
jblanco2281
Starting Member
4 Posts |
Posted - 2010-09-10 : 15:31:06
|
| Thanks man, how do I modify the stored procedure to return Output parameters??? I think that would be the best solution and how do I assign those returned output parameters into variables??? |
 |
|
|
jblanco2281
Starting Member
4 Posts |
Posted - 2010-09-10 : 15:41:35
|
| Sorry about the man... I just noticed you are a woman... |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2010-09-10 : 15:47:56
|
| Here's an example:CREATE PROC sp1 (@var1 int, @var2 int OUTPUT, @var3 varchar(50) OUTPUT)ASSELECT @var2 = ColumnA, @var3 = ColumnBFROM tbl1WHERE Column1 = @var1GODECLARE @newVar1 int, @newVar2 int, @newVar3 varchar(50) --the variables can be the same name, I just used new ones to make it clear.EXEC sp1 @var1 = @newVar1, @newVar2 OUTPUT, @newVar3 OUTPUTYou've now got the values loaded into variables.Hope this was clear!Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
 |
|
|
jblanco2281
Starting Member
4 Posts |
Posted - 2010-09-10 : 15:53:19
|
| Thank you very much I think this really gave me a clear idea of what to do... |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|
|
|