In sql server we can compile any sql server quires without executing it by setting the property NOEXEC.
Syntax:
SET NOEXEC {ON|OFF}
When It is set to on then if we execute any sql quries it will only compile it while if it is set to off then it will compile the sql quries as will execute it. Default is off. For example:
SET NOEXEC OFF
SELECT 'Exact Help'
Output:
Exact Help
When we will execute the above query first it will compile then execute it .
SET NOEXEC ON
SELECT 'Exact Help'
Output:
No output.
When we will execute the above query it will only compile.
Use of NOEXEC ON
- To check the synax of sql statements.
- To check the existance of objects.
- To debug the batch of quries.
Scope of NOEXEC property:
Scope of NOEXEC property is within a session. In other session we have to set the NOEXEC property once again.
Note:
When we login or open a new query page or tab we creates a new session in sql server.