Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Management Studio Query Execution Ignoring Batch GO Statements

$
0
0

Is it possible to run a script with several batches where one batch depends on an object that is created in a previous batch? I am getting the error "Invalid object name 'blah blah.' But this object is created in a previous batch in the same script. Each batch is separated by GO on its own line. Is there an option to run each batch and ignore error detection?

I am running the execution in SQLSMD mode because I have :setvar statements. 

In the specific example of this error I have a batch that creates a function. The final line of this batch is GO. Later in the script, I have a batch that alters a stored procedure and references this new function. I get the following error (sorry I can not include actual object names in this post): 

Msg 208, Level 16, State 1, Procedure xxxx, Line 29
Invalid object name 'xx.xxxx'.
** An error was encountered during execution of batch. Exiting.


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>