Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Database project build fails due to syntax errors in non-existent files

I am trying to build a database project where I was trying to create a system-versioned table within my Visual Studio 2017 solution, but I am suddenly getting an error:

SQL46010: Incorrect syntax near ]

Normally, that would be a simple fix....except the file it refers to doesn't exist! When I double-click the error within the Error List, I get:

Cannot find file 'MSSQL::dbo.TestHISTORY'

The table it refers to is one that I had named as part of the SYSTEM_VERSIONING = ON (minus the MSSQL:: prefix) command for another table I created. I have restarted Visual Studio, reverted all the changes I made to the database project, restarted my PC, performed a Clean operation against the project but all to no avail!

Has anyone else come up against this error?

like image 608
Steven Brookes Avatar asked Apr 09 '19 09:04

Steven Brookes


People also ask

What does syntax error mean in SQL?

The most common SQL error is a syntax error. What does syntax mean? Basically, it means a set arrangement of words and commands. If you use improper syntax, the database does not know what you're trying to tell it.

What are the syntax related errors in this query?

This SQL error generally means that somewhere in the query, there is invalid syntax. Some common examples: Using a database-specific SQL for the wrong database (eg BigQuery supports DATE_ADD, but Redshift supports DATEADD) Typo in the SQL (missing comma, misspelled word, etc)


1 Answers

I managed to fix this problem by deleting the .jfm and .dbmdl files from the root directory for the database project. After restarting Visual Studio the database project would finally build!

like image 126
Steven Brookes Avatar answered Oct 14 '22 01:10

Steven Brookes