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 |
|
marconi8
Yak Posting Veteran
73 Posts |
Posted - 2003-05-12 : 04:16:24
|
| for examplesp_executesql=N'SELECT @VAR = COUNT(ID) FROM .....i call sp_executesql in sp, and after sp_executesql i must to operate this this variable @VAR , cannot get a var i can see only result sets returned by sp_executesql, but how to get parameter from sp_executesqlthanks |
|
|
Andraax
Aged Yak Warrior
790 Posts |
Posted - 2003-05-12 : 04:25:44
|
| Hi!The statement executed by sp_executesql is not in the same context as so you cannot reference the same variables within it as outside it. An option is to use something like:declare @tmp table (var int)declare @var intinsert @tmpexec sp_executesql N'SELECT ....select @var=varfrom @tmpShould work. (not tested) |
 |
|
|
|
|
|