SSMS Throws Spurious "Incorrect Syntax .." Error - by RBarryYoung

Status : 

  Won't Fix<br /><br />
		Due to several factors the product team decided to focus its efforts on other items.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


1
0
Sign in
to vote
ID 775641 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 1/2/2013 2:42:43 PM
Access Restriction Public

Description

When I execute the following text verbatim in SSMS:

    update #CACFederalReserverHolidays
     set BankHoliday = 0

It throws the error "Incorrect syntax near ' '."  As far as I can tell it should just say that the #temp table is undefined.  (Even if the #temp table is defined, it throws the same error.)

I got this from a user's question on a support forum (here: http://stackoverflow.com/questions/14129706/update-a-temp-table/14130003#14130003).  
Cutting and pasting the user's text into my SSMS, I was able to narrow it down to these two lines.  After a lot of editing and testing, I found that the problem would only go away if I removed the line-break and spaces between the first and second line and then re-entered them myself.  Suspecting some invisible/invalid character, I then quoted the text and examined it character by character with:

select unicode(substring('update #CACFederalReserverHolidays
 set BankHolidayX = 0', 35,1))

But looking at characters 35, 36, and 37, only revealed the Unicode values 13, 10, and 63 (CR, LF and Space).

As far as I can tell, this must be a bug, either in Management Studio, or in the SQL Server Parser itself.

Note that I have only reproduced this on SQL Server 2012 so far, but the original user reported it from SQL Server 2008.
Sign in to post a comment.
Posted by Microsoft on 1/29/2013 at 1:33 PM
Hello

I understand that issues was resolved so we are closing this issue, you can always reactivate and provide more details.

Thank you
Alex Grach[MSFT]
Posted by RBarryYoung on 1/2/2013 at 2:53 PM
OK, I have just realized that my examination procedure above was flawed because I was converting it to ASCII before looking at the Unicode values. When I use the correct expression:

select unicode(substring(N'update #CACFederalReserverHolidays
 set BankHolidayX = 0', 37,1))

It reveals that character 37 is actually Unicode value 8200. I am unfamiliar with this but I assume that it is invalid. So I do not know if this still qualifies as a bug or not.