patternModerate
Executing TSQL script generated from SSMS in SQLCMD. Failing on quotes
Viewed 0 times
scriptexecutingtsqlgeneratedssmsfailingquotessqlcmdfrom
Problem
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:
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?
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.txtI'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?
Solution
$(...) denotes a variable in SQLCMD, so it's interpreting your data as a variable.Use the
-x command-line option to disable variables.Context
StackExchange Database Administrators Q#24906, answer score: 12
Revisions (0)
No revisions yet.