9

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:

$(''.cat-menu-new'').slideDown(''slow'');

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

Hannah Vernon
71.1k22 gold badges178 silver badges323 bronze badges
asked Sep 25, 2012 at 21:30
4
  • The script above looks like JQuery not SQL...??? Commented Sep 25, 2012 at 21:41
  • Are you scripting out the data as well? Can you post any more of the script that was generated? Commented Sep 25, 2012 at 21:53
  • 40k+ line script? Ouch. Commented Sep 25, 2012 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. Commented Oct 3, 2012 at 15:56

1 Answer 1

12

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

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

answered Sep 25, 2012 at 22:09
2
  • 11 years later and this answer is still helping frustrated developers :) Commented Jun 27, 2023 at 15:20
  • In the "go" version of sqlcmd, there's a bug in version 1.7.0 and lower that still tries to parse the placeholders. It's fixed in version 1.8.0. github.com/microsoft/go-sqlcmd/issues/541 Commented Aug 7, 2024 at 9:02

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.