关于SSIS中代码页(Code Page) 相关错误

今天我也遇到这个问题了,真坑爹!让boss说我低能 55555.。。

 

The column “xxxx” cannot be processed because more than one code page (1252 and 936) are specified for…

网上有云:

              将某控件的属性AlwaysUseDefaultCodePage设置为true,DefaultCodePage也应为936

              就可解决

我试了一下 根本不允许设置

后来才发现

与sql server中Collation的设置有关

sql server不同语言的版本在创建数据库时,会默认不同的Collation设置

这才是根本

-----------------------------------------------------------------------------------------------------

CREATE DATABASE TestCollation
go
USE TestCollation
go
SELECT DATABASEPROPERTYEX('TestCollation', 'Collation')
-- the default for us english without changes at the windows layer or changes during SQL Server install is:
-- SQL_Latin1_General_CP1_CI_AS
-- To force it use:
-- CREATE DATABASE TestCollation
-- COLLATE SQL_Latin1_General_CP1_CI_AS

go
-- To see the list of collations use the system function
SELECT * FROM ::fn_helpcollations()
go

-- Since this started from a question on how can I CHANGE collations here's how.
-- Let's change the collation to a case sensitive collation...

ALTER DATABASE TestCollation COLLATE Latin1_General_CS_AS_KS_WS
go

-- Confirm the change?
SELECT DATABASEPROPERTYEX('TestCollation', 'Collation')
go

-- Create some objects
CREATE TABLE dbo.Test
( Col1 int  NOT NULL)
go

CREATE TABLE dbo.test
( Col1 int  NOT NULL)
go

CREATE TABLE dbo.TEST
( Col1 int  NOT NULL)
go

-- Now try to change back to case insensitive...
ALTER DATABASE TestCollation COLLATE SQL_Latin1_General_CP1_CI_AS
go

-- This will generate these helpful messages:
-- Server: Msg 1505, Level 16, State 1, Line 1
-- CREATE UNIQUE INDEX terminated because a duplicate key was found for index ID 2. Most significant primary key is 'test'.
-- Server: Msg 3436, Level 16, State 1, Line 1
-- Cannot rebuild index for the 'sysobjects' table in the 'TestCollation' database.
-- Server: Msg 5072, Level 16, State 1, Line 1
-- ALTER DATABASE failed. The default collation of database 'TestCollation' cannot be set to
SQL_Latin1_General_CP1_CI_AS.

-- To see the server's setting
sp_helpsort

-- To see the database's setting
sp_helpdb TestCollation

-- To see the table's setting (for each column)
sp_help Test

 -------------------------------------------------------------------------------------------------

posted @ 2012-07-15 11:31  赤狐(zcm123)  阅读(933)  评论(0编辑  收藏  举报