Answers

Question and Answer:

  Home  MS SQL Server

⟩ What Happens to a Statement Batch If There Is a Compilation Error?

If a statement batch has multiple statements, and one of them has compilation error, all statements in the batch will not be executed. The tutorial exercise below gives you some good examples:

SELECT getdate();

SELECT getdates();

SELECT getdate();

GO

Msg 195, Level 15, State 10, Line 2

'getdates' is not a recognized built-in function name.

As you can see, the compilation error on the second statement stops the execution of all statements.

 131 views

More Questions for you: