Collections:
Compilation Error in a Statement Batch in SQL Server
What happens to a Transact-SQL statement batch if there is a compilation error?
✍: FYIcenter.com
If a Transact-SQL statement batch has multiple statements, and one of them has compilation error, none of the statements in the batch will be executed. The tutorial exercise below gives you some good examples:
SELECT getdate(); SELECT getdates(); SELECT getdate(); ---------------------------- 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.
⇒ SQL Server Transact-SQL Language References
⇐ Statement Batch in SQL Server Transact-SQL
2017-05-29, 1667🔥, 0💬
Popular Posts:
How to execute statements in loops in SQL Server Transact-SQL? How to use WHILE ... loops? You can u...
Where to find answers to frequently asked questions on PHP Connections and Query Execution for MySQL...
What Is the Difference Between GETDATE() and GETUTCDATE() in SQL Server Transact-SQL? The difference...
What Happens If the UPDATE Subquery Returns Multiple Rows in SQL Server? If a subquery is used in a ...
How To Insert New Line Characters into Strings in SQL Server Transact-SQL? If you want to break a st...