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-04-07 : 07:42:57
|
| cleggster writes "Why I am getting this problem?> Call the following procedure using> exec test_goto 'Test1'>> CREATE PROCEDURE [test_goto]>> @Param varchar(10) = null>> AS>> exec('goto ' + @Param)>>> Test1:>> Executing the above procedure creates the following> sql server 2000 warning/error.>> Server: Msg 133, Level 15, State 1, Line 1> A GOTO statement references the label 'test1' but the> label has not been declared.>> However if you hard code in 'goto test1' the> procedure succefully recognises the label!>> Can anyone help me as the execute syntax looks correct> and I am at a loss as to what the problem is.> This method is being used in a large batch system> currently under development and i need help!>> Thanks." |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2003-04-07 : 09:47:16
|
| because the exec runs the code in a different batch and none of the labels/variables defined in the outer batch are available.Who's designing your large batch system?Alarm bells ring loudly.==========================================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. |
 |
|
|
|
|
|