Home > SQL Server > Parsing SQL statements – SET PARSEONLY – SQL Server

Parsing SQL statements – SET PARSEONLY – SQL Server


SET PARSEONLY: This set statement configure the current session to parsing only mode. So, it parses all the sql statements given by the user. But, If there is an error in the syntax of the statements, it will throw an error message. ParseOnly set statement does not compile or execute the sql statements. Parseonly set statement should not be used in the stored procedure or functions.

Usage

SET PARSEONLY ON
Or
SET PARSEONLY OFF
 

Example

1. Parseonly statement is OFF. Now, we are executing an error less sql statement.

pic1It compiled and executed the given SQL statement.

2. Parseonly statement is ON, Now we are executing a sql statement with error and see what happen?

pic2it throws an error because the SQL statement was missing character *
3. Pareonly statement is ON, Now executing an error free statement.

pic3Now, it does not returns any result. Because, the parseonly set statement is on.

You can also learn about SET NOEXEC.

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: