1

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! Commented Dec 18, 2015 at 11:31

1 Answer 1

1

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).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.