Query editor mistery

If a statement is terminated by ascii 0D only, SQL 2000 query analyzer can parse it correctly. But in SQL 2005 SSMS query editor, it will give an error.
Run the following code in SQL 2000 and SQL 2K5, copy the printed message from the message pane into the query editor respectly and run.

PRINT ‘SET QUOTED_IDENTIFIER OFF’+nchar(13)+‘GO’

 

In SQL 2000, it is succeeded. In SQL 2005, it gives the error

Msg 102, Level 15, State 1, Line 1

Incorrect syntax near ‘GO’.

 

If we change the code to:

 

PRINT ‘SET QUOTED_IDENTIFIER OFF’+nchar(13)+nchar(10)+‘GO’

Repeat the above process, it is succeeded both in SQL 2000 and SQL 2005

 

 

 

Advertisements
This entry was posted in SQL server 2005. Bookmark the permalink.

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