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 - 2001-09-17 : 20:13:30
|
Shane writes "I have a temp table that looks something like this:RowID DBName sSQL----- ------ -----------------------1 db1 select sample1 from db12 db2 select sample2 from db23 db3 select sample3 from db3 The sSQL column can change at any given moment. I want to be able to step through each row of the temp table, execute the specific sSQL for that row, return that record set, create a second (nested) loop to step through each row of the record set.I have tried the following approach (and have gone nowhere):--This generates the record set, but won't capture into a--temporary table, or cursorselect @tempsql = ssql from #temptable1 where rowid = @currentrowexec (@tempsql)I have also tried (and have gone nowhere):select @tempsql = ssql from #temptable1 where rowid = @currentrow--Poor cursor syntaxdeclare myCursor cursor forexec (@tempsql)This is defined as *.sql script file." |
|
|
|
|
|