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 |
rtutus
Aged Yak Warrior
522 Posts |
Posted - 2007-02-25 : 11:09:37
|
Hi dear,I want to assign the variable @myVar an input to my stored procedure parameter @myParam. But I want to do that my cursor code:declare @myVar as..fetch next from crsMyTblParams into @DBparamwhile @@fetch_status=0 beginEXEC sys.sp_helprotect @username=@myVarfetch next from crsMyTblParams into @DBparamend close crsMyTblParamsdeallocate crsMyTblParams But that gives me an error2/ another question pls: how can I use the same thing for a varibale like this:declare @myDB...cursor codeuse @myDB....rest of cursor code...end of cursor codeIs that possible , thank you |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2007-02-25 : 20:22:29
|
1. Not sure what you are trying to do here. Should the fetch use @myVar instead of @DBParam?2. You can't use a use statement in an sp unless it's in dynamic sqlexec ('use ' + @myDB + ' exec ... select ...')You will probably find this easier if you don't try to use a cursor. Create a temp table with the values you want and an identity and loop through it.==========================================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. |
 |
|
|
|
|