SQL Server 2008 生成脚本向导为我提供了一个导致“未关闭引号"的脚本 [英] SQL Server 2008 generate script wizard gives me a script that results in "unclosed quotation marks"

查看:33
本文介绍了SQL Server 2008 生成脚本向导为我提供了一个导致“未关闭引号"的脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一台机器上有一个 SQL server 2008 数据库实例.现在我想把这个数据库复制到另一台机器上.我使用 SQL Management Studio 中的脚本向导生成包含架构和数据的 SQL 脚本.脚本文件相当大(大约 17 GB).

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 generate a SQl-script with the schema and data. The script-file is rather big (around 17 GB).

然后我在目标机器上运行 sql 脚本,结果是:

Then I run the sql-script on the target machine it results in a :

消息 105,级别 15,状态 1 错误消息:字符串后的非封闭引号

Msg 105, Level 15, State 1 error with the message: Unclosed quotation mark after the character string

我确实理解未闭合引号的含义的问题.但我不明白为什么会发生错误.脚本生成器不能处理文本字符串中的引号,比如...你好,怎么了...正确地创建一个可以转义这些字符的脚本?

I do understand the problem of what unclosed quotation marks mean. But I don't understand why the error happens. Isn't the script generator able to handle quotations inside text strings like...hello, what's up...correctly and create a script that will escape such characters?

他们对脚本向导的文本长度有限制吗?这是否会导致问题.

Is their a limit on the length of text for the script wizard? Is this causing the problem.

我不想也无法在文本编辑器中打开脚本文件(太大,文本编辑器会崩溃)并手动修复问题.

I don't want to and I cannot open the script-file in a text editor (too large, text editor will crash) and manually fix the problems.

你有什么想法吗?

推荐答案

不是直接回答这个问题,而是为了避免这个问题,您可以使用以下其他方法之一将数据库复制到新位置.

Not a direct answer to the question but to duck this issue you could use one of the following other methods of copying the database to the new location.

  1. 通过备份和还原复制数据库
  2. 使用分离和附加

方法 1 通常更可取,因为它使源数据库保持在线,而分离可能会导致主数据库中保存的有关源的信息丢失(例如全文启用状态)

Method 1 is usually preferable as it keeps the source DB online and detaching can cause information held in the master database about the source to be lost (e.g. full text enabled status)

这篇关于SQL Server 2008 生成脚本向导为我提供了一个导致“未关闭引号"的脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆