更改 SQL 服务器中的排序规则

Change Collation in SQL Server

我试过像这样更改排序规则数据库:

ALTER DATABASE [MYDB] 
SET SINGLE_USER WITH ROLLBACK IMMEDIATE; 
GO 

ALTER DATABASE [MYDB]
COLLATE SQL_Latin1_General_CP1_CI_AS
GO 

ALTER DATABASE [MYDB] 
SET MULTI_USER; 
GO 

但是我得到了这个错误:

Nonqualified transactions are being rolled back. Estimated rollback completion: 0%.
Nonqualified transactions are being rolled back. Estimated rollback completion: 100%.
Warning: Changing default collation for database 'MYDB', which is used in replication. All replication databases should have the same default collation.

Msg 5075, Level 16, State 1, Line 10
The object 'CK_PriceL_EndDate' 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.

Msg 5075, Level 16, State 1, Line 10
The object 'CK_PriceL_Price' 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.

Msg 5075, Level 16, State 1, Line 10
The object 'chk_trades_year' 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.

Msg 5075, Level 16, State 1, Line 10
The object 'chk_trades_month' 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.

Msg 5075, Level 16, State 1, Line 10
The object 'SplitObjects' 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.

Msg 5072, Level 16, State 1, Line 10
ALTER DATABASE failed. The default collation of database 'MYDB' cannot be set to SQL_Latin1_General_CP1_CI_AS.

我在 doc.microsoft

中阅读了如何将单用户设置为多用户

我在 doc.microsoft

中阅读了如何设置或更改数据库排序规则

注意:此服务器是复制的主要发布者,我使用SQL Server 2019

我终于可以找到更改 SQL 安装后服务器整理的答案。

我们可以运行通过这个bat文件来进行修改整理。 (将以下代码保存为文本并将文件类型更改为 .bat),然后以管理员身份 运行。

这个文件代码很简单:

cd C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER2008\MSSQL\Binn
sqlservr -m -T4022 -T3659 -s"MSSQLServer2008" -q"SQL_Latin1_General_CP1_CI_AS"

这清楚任何人都需要特殊路径和实例名称。