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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-06-09 : 08:21:05
|
| Nelson P. Varghese writes "How can I store result of stored procedure into a cursor variableDeclare @cur cursorexec @cur = sp_columns '<table_name>'won't workNelson P. Varghese" |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2003-06-09 : 08:21:16
|
| Why would you want to? |
 |
|
|
ajthepoolman
Constraint Violating Yak Guru
384 Posts |
Posted - 2003-06-09 : 12:22:00
|
| In your cursor, you will declare a variable to hold the return value from your stored procedure.DECLARE @Score varchar(500)Then somewhere in your cursor you will execute your stored procedure, passing in the necessary variables and then setting @Score equal to the Output variable in your stored procedure.EXEC qryStoredProcedureName @intPassedInID, @txtResult = @Score OUTPUTYou stored procedure should have something like this: CREATE PROCEDURE qryStoredProcedureName @intRecID INT, @txtResult varchar(500) output -- <----That is the output ASYou can now use @Score to display data or whatever. Just remember that @Score is going to be overwritten each time the cursor fires. So any further manupulation of @Score must be done inside the cursor.Aj |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2003-06-09 : 12:40:16
|
quote: "How can I store result of stored procedure into a cursor variable"
pronoun trouble -- B. BunnyBrett8-) |
 |
|
|
|
|
|