Without executing the T-SQL query we can validate the Query in SQL server by using the following Syntax
Syntax:
SET NOEXEC ON
QUERY
SET NOEXEC OFF
Example:
SET NOEXEC ON
SELECT * FROM STUDENTFORM
SET NOEXEC OFF
In above example,before select statement we have set the noexec to ON and after select statement
we have set noexec to OFF.
If we execute the above statement it will validate the query rather than executing the statement.
So using this NOEXEC statement we can validate the query without worrying about the syntax.
Finally do not forget to OFF the NOEXEC statement.
You can use update or delete statement instead of select statement in above example.
No comments:
Post a Comment