1
votes

In my SSDT project I have a post deployment script where I include a script file.

:r .\Data\Data.Content.sql

The file Data.Content.sql is a dump of the database (insert statements) and it contains content like 'var $sameHeightDivs = $(''.product-tile-region'');'. The database contains JQuery scripts. So I receive the following errors:

SQL72008: Variable document is not defined. or 72006: Fatal scripting error: Incorrect syntax was encountered while parsing '$(''

I found that you can disable 'disable variable substitution' with the argument -x.

But is there a way to define this somewhere? (post-deployment script? project setting?)

Or is there another way to solve this problem?

FYI: to create the dump I use Microsoft.SqlServer.Management.Smo.Scripter.

Kind regards,

bob

1
Wow, it seems the SSDT team really hate people who use jQuery! - Rory

1 Answers

1
votes

I posted the same question in the SQL Server Data Tools forum where someone came with a workaround.

After the script generation I do a search and replace for the $ char.

function SearchAndReplace($file) {
    (Get-Content $file) | 
    Foreach-Object {$_ -replace "\$\(", "' + CHAR(36) + '("} | 
    Set-Content $file
}

I included the '(' to be sure to limit the scope (to JQuery selectors).