When I execute the following text verbatim in SSMS: update #CACFederalReserverHolidays set BankHoliday = 0It 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.
Product Language
Version
Category
Operating System
Operating System Language
Steps to Reproduce
Actual Results
Expected Results
Platform
Virtualization