2011-09-10 56 views
13

當我試圖把現有的數據庫(包括數據)的整理,從ARABIC_CS_AS改變PERSIAN_100_CS_AS出現以下錯誤:問題與數據庫歸類改變(SQL Server 2008中)

Alter failed for Database 'XXXX'. (Microsoft.SqlServer.Smo)

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

The object 'ItemTables' is dependent on database collation. The database collation cannot be changed if a schema-bound object depends on it. Remove the dependencies on the database collation and then retry the operation.
The object 'CK_FilteredReportColumnFilters' is dependent on database collation. The database collation cannot be changed if a schema-bound object depends on it. Remove the dependencies on the database collation and then retry the operation.
The object 'CK_FilteredReportColumnFilters_1' is dependent on database collation. The database collation cannot be changed if a schema-bound object depends on it. Remove the dependencies on the database collation and then retry the operation.
The object 'CK_FilteredReportColumnFilters_2' is dependent on database collation. The database collation cannot be changed if a schema-bound object depends on it. Remove the dependencies on the database collation and then retry the operation.
The object 'CK_Reports' is dependent on database collation. The database collation cannot be changed if a schema-bound object depends on it. Remove the dependencies on the database collation and then retry the operation.

ALTER DATABASE failed. The default collation of database 'XXXX' cannot be set to Persian_100_CS_AS. (Microsoft SQL Server, Error: 5075)

試圖糾正提到的錯誤通過刪除這些數據庫對象導致轉換過程中與其他標題的另一個錯誤。

有什麼想法?是否有任何明確的解決方案來解決這個問題?

+0

[更改SQL 2005中聚簇索引列上的排序規則]的可能重複實際上是(http://stackoverflow.com/questions/581517/change-collat​​ion-on-clustered-index-column-in-sql-2005) – gbn

回答

14

啊,這是SQL Server中最糟糕的問題之一:創建對象後無法更改排序規則(對於表和數據庫都是這樣)...)。

您只能保存您的數據(不要使用bcp或備份實用程序,您需要將它們置於類似文件類型的csv中...),刪除數據庫,使用正確的歸類重新創建並重新導入將數據導入新的數據庫...

希望這有助於。

+0

您可以在不刪除表的情況下更改列的排序規則。除了依賴於的列外,例如通過計算列,約束或索引。 –

2

我已經得到了同樣的問題,所有的對象都是功能 首先需要全備份

腳本功能創建。 刪除,那麼這些功能運行

use master 
go 
ALTER DATABASE xxx SET SINGLE_USER WITH ROLLBACK IMMEDIATE 
go 
ALTER DATABASE xxx COLLATE yyyy 
go 
ALTER DATABASE xxx SET MULTI_USER 
go 

重新創建功能

我希望這是很有幫助的。

+0

這個建議有什麼問題? – fedd

+0

如果模式綁定對象依賴於該數據庫,則無法更改數據庫排序規則。檢查約束和存儲過程(如果我沒有弄錯),將不允許整理更改。 – Kad

0

只需創建新的數據庫與ex database_b.change根據您的要求的排序規則和 從新源輸出到目標。

使用ALT整理工具,這將覆蓋所有的錯誤。

--Appu

+0

什麼是alt歸類工具? – AutomationNation

-1

只需在寫入字符串之前輸入N即可。

例如:

insert into table values (N'yourstring') 

N = unicode的。