SQL Server 2008 generate script wizard gives me a script that results in “unclosed quotation marks”

后端 未结 4 441
醉话见心
醉话见心 2021-01-14 10:36

I have an SQL server 2008 database instance on one machine. Now I want to copy this database to another machine. I use the script wizard inside SQL Management Studio to gene

4条回答
  •  逝去的感伤
    2021-01-14 11:20

    I ended up on this question after trying to find a solution to a similar problem I had. I also needed to dump a DB (with data) via Generate scripts wizard and the resulting file was too big to be executed from SSMS. So I tried the sqlcmd but ended with the error

    Sqlcmd: Error: Syntax error at line 10 near command '"' in file 'script.sql'.

    It turned out the cause of the issue was a record containing data with jQuery syntax in it - $(".someclass"). It's because it is also a way how to insert a variable into sqlcmd.

    The solution is to disable variable substitution by adding -x command line argument.

提交回复
热议问题