I have a SQL Data Project that was created from the schema of my production database. It pulled in all the stored procedures into the project and I am trying to deploy the generated scripts to localdb for offline development.
The Issue is that it appears SQL Data Project is trying to validate the SQL script that it generated but its getting stuck at the first instance where it encounters a string containing $(
.
Example 1
INSERT INTO mytable (text) VALUES ('$(')
This results in an error
Incorrect Syntax was encountered while $(' was being parsed.
Example 2
INSERT INTO mytable (text) VALUES ('$(this')
This results in an error
Incorrect Syntax was encountered while $(this' was being parsed.
Its seems like a bug in SQL Data Projects parse validation which is preventing the deployment from succeeding even though the scripts execute fine in SQL Management Studio.
UPDATE
I tried some of the ideas and it seems the issue is specifically when SQL Data Project is parsing the string and encounters $(
. In addition, everything that follows the $( in the string gets caught by the error up until the next instance of a single quote (Be it an escaping single quote or the end of the string single quote)
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)
When executing a query in SQL and the editor throws back this error: Incorrect syntax near …'' That typically means you have used the wrong syntax for the query. This happens mostly when someone switched from one relational database to another relational database, from MySQL to MS SQL Server for example.
The cause of these problems can vary from file system corruption, underlying hardware system issues, driver issues, corrupted pages in memory, or problems with the SQL Server Engine.
It seems that the script that SQL Data Tools generates for deployment of the database uses $()
as a way of doing variable replacement. To correct the issue I had to replace the contents of the string with
CHAR(36) + '()'
to represent
$()
This way the parser wouldn't try to see it as a variable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With