Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am attempting to deploy a database to a machine by executing a script generated by the "Generate Scripts" tool in SQL Server Management Studio.

Here is the command I've issued:

sqlcmd -S LOCALHOST\sqlexpress -I -U user -P ******** -i 
    C:\Rollouts\NI-9-25-2012_10-42-AM\Rollout.sql > rolloutlog.txt

I'm receiving errors like this:

Sqlcmd: Error: Syntax error at line 39488 near command ''' in file 'C:\Rollouts\ NI-9-25-2012_10-42-AM\Rollout.sql'.

When I view this line with a text editor all signs point to an issue with quotation marks.

The line in question looks like this:


Is there a switch that I should be executing or generating the script with to support quotes within the script?

share|improve this question
The script above looks like JQuery not SQL...??? – Mr.Brownstone Sep 25 '12 at 21:41
Are you scripting out the data as well? Can you post any more of the script that was generated? – Mr.Brownstone Sep 25 '12 at 21:53
40k+ line script? Ouch. – Aaron Bertrand Sep 25 '12 at 23:25
Haha to clarify a bit more. The script includes HTML and javascript content so yes that content is jQuery code. We ended up creating a backup script that is much faster and easier. – munroan Oct 3 '12 at 15:56
up vote 7 down vote accepted

$(...) denotes a variable in SQLCMD, so it's interpreting your data as a variable.

Use the -x command-line option to disable variables.

share|improve this answer
Thank you, Jon! You made my day :-) – LayZee Feb 2 at 6:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.