sqlserver导入数据时常出现的错误解答

在做SSIS项目的Data Coversion时,经常会遇到类似如下两个问题:

 1.Validating (Error)

       Messages

         * Error 0xc02020f4: Data Flow Task 1: The column "xxxx" cannot be processed because more than one code page (936 and 1252) are specified for it.

          (SQL Server Import and Export Wizard)

        * Error 0xc02020f4: Data Flow Task 1: The column "xxxx" cannot be processed because more than one code page (936 and 1252) are specified for it.

          (SQL Server Import and Export Wizard)

    解决:检查你源数据库和目标数据库的排序规则是否不一致,如果Code Page不一致,就会出现大量上面错误。

  2:在验证时出现下面错误信息

- Validating (Error)

            Messages

                  * Error 0xc0202049: Data Flow Task 1: Failure inserting into the read-only column "xxxxx".

                  (SQL Server Import and Export Wizard)

                  * Error 0xc0202045: Data Flow Task 1: Column metadata validation failed.

                  (SQL Server Import and Export Wizard)

    解决:出现这个错误,是因为这一列是自动增长,需要在”Edite Mappings" 选项里面勾选“Enable Identity Insert”选项。

      MSDN对于Code Page的解释是:对于字符和 Unicode 数据,代码页是代表特定字母、数字或符号的位模式的定义(例如 0x20 代表空格,0x74 代表字符“t”)。某些数据类型为每个字符使用一个字节;每个字节的位模式可以是 256 种不同位模式之一。

今天得到的一个解决方法是:

在用sqlserver导入 导出向导时,勾选“Enable Identity Insert”选项。导完保存ssis包,如果出现Code Page的错误。那么进行下一步:

右击保存的ssis包-编辑,出现数据流窗口,右键点击OLE DB Source控件,点击Show Advanced Editor…

在弹出的窗口中选择Component Properties,然后将在这里将属性AlwaysUseDefaultCodePage设置为true,DefaultCodePage也应为936。

这样两个错误都解决了。

原文地址:https://www.cnblogs.com/bowenlearning/p/3897911.html