title: Visual Studio thinks correct SQL syntax is incorrect
body: <p>In Visual Studio 2013, I have created a database project and imported an existing database. At first all was fine, and the project built and produced create scripts.</p>
  
  <p>However, now Visual Studio seems to think that there are SQL syntax errors, returning several <code>SQL46010: Incorrect syntax near:</code> errors. These are all from code generated by VS - I have not written any of it.</p>
  
  <p><strong>Example 1:</strong></p>
  
  <pre><code>ALTER ROLE [db_owner] ADD MEMBER [SomeUser];
  SQL46010: Incorrect syntax near ADD.
  </code></pre>
  
  <p><strong>Example 2:</strong></p>
  
  <pre><code>DECLARE @Foo NVARCHAR(7) = 'abcdefg';
  SQL46010: Incorrect syntax near =.
  </code></pre>
  
  <p>If I copy/paste the code into SSMS, everything works fine.</p>
  
  <p>Unfortunately, these prevent the project from building, which means I can't publish. Since they are errors, not warnings, I cannot set them to be ignored in the project settings.</p>
  
  <p>A workaround exists where I can set the problem files' Build Action to None, but I need these files included when I publish.</p>
  
  <p><strong>I have tried:</strong></p>
  
  <ul>
  <li>Deleting and re-adding the same code</li>
  <li>Copy/pasting code to new SQL file</li>
  <li>Closing and reopening the solution</li>
  <li>Closing and reopening Visual Studio</li>
  <li>Updating Microsoft SQL Server Data Tools (SSDT)</li>
  <li>Updating Visual Studio</li>
  </ul>
  
  <p>The closest problem I have been able to find is <a href="https://social.msdn.microsoft.com/Forums/sqlserver/en-US/eb1815a2-cb71-41d1-8488-628ef7a436c2/attempt-to-build-a-project-fails-with-the-error-sql46010-incorrect-syntax-near-offset?forum=ssdt" rel="noreferrer">this MSDN thread</a> from 2012, stating that there is a bug SSDT SQL parser (which prompted me to try updating SSDT).</p>