Search notes:

SQL Server: set noexec

set noexec on|off controls if the following T-SQL statements are executed or parsed only.
The following example contains three SQL batches. In the middle of the second batch, the execution of staments is turned off with set noexec on, in the middle of the thirds batch, it's turned on again.
print ('First batch');
go

print ('Second batch, first print statement');
set noexec on
print ('Second batch, second print statement');
go

print ('Third batch, first print statement');
set noexec off
print ('Third batch, second print statement');
go
Github repository about-MSSQL, path: /t-sql/statements/set/noexec/basic-usage.sql
When executed, the following is printed:
First batch
Second batch, first print statement
Third batch, second print statement

See also

The T-SQL set statement

Index