整理错误 [英] Collation Error

查看:20
本文介绍了整理错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Microsoft SQL Server Management Studio.我有两个数据库,一个是系统数据库,它有主数据库,另一个是我的数据库,名为 CCTNS_CAS_DE_DB.当我尝试通过使用 CCTNS_CAS_DE_DB 数据库的工具生成报告时.

I am using Microsoft SQL Server Management Studio. I have two databases one is the system database, which has the master database and the other one is my database called CCTNS_CAS_DE_DB. When I am trying to generate the reports through the tool which uses the CCTNS_CAS_DE_DB database.

我收到以下错误:

无法解决等于操作中Latin1_General_CI_AI"和SQL_Latin1_General_CP1_CI_AS"之间的排序规则冲突

我浏览了 SQL Server 并检查了主数据库的属性,它显示排序规则为 Latin1_General_CI_AI 但是当我转到 CCTNS_CAS_DE_DB 数据库的属性时它显示排序规则为 SQL_Latin1_General_CP1_CI_AS.

I went through the SQL Server and checked the properties of the master database it shows the collation as Latin1_General_CI_AI but when I went to the properties of the CCTNS_CAS_DE_DB database it shows the collation as SQL_Latin1_General_CP1_CI_AS.

我在网上搜索了错误,但大多数解决方案都告诉了如何更改特定表的排序规则,但我没有遇到任何将我的数据库的排序规则更改为 Latin1_General_CI_AI 的查询.

I searched for the error online but most of the solution tell how to change the collation of a particular table but I didn't come across any query which will change the collation my database to Latin1_General_CI_AI.

我遇到了一个问题:-

I came across one query which is:-

ALTER DATABASE CCTNS_CAS_DE_DB COLLATE Latin1_General_CI_AI

当我在我的 SQL Server 中运行这个查询时,它抛出了以下错误:-

When I ran this query in my SQL Server it threw the following error:-

消息 5030,第 16 级,状态 2,第 1 行
无法以独占方式锁定数据库以执行该操作.
消息 5072,第 16 级,状态 1,第 1 行
ALTER DATABASE 失败.数据库'CCTNS_CAS_DE_DB'的默认排序规则不能设置为Latin1_General_CI_AI.

我知道这个问题已经在这里发布,但我认为那是在不同的背景下.

I know this question has already been posted here but that was in a different context I think.

推荐答案

这是对您问题的最大提示:

Here's the biggest hint to your problem:

消息 5030,级别 16,状态 2,第 1 行数据库无法以独占方式锁定以执行操作.

Msg 5030, Level 16, State 2, Line 1 The database could not be exclusively locked to perform the operation.

您需要做的是在运行 ALTER DATABASE 语句之前将数据库设置为单用户模式,然后在完成后将其设置回多用户模式.这将锁定数据库并使其仅对当前连接可用,这将允许您成功运行 ALTER DATABASE ... COLLATE 语句.

What you need to do is set the database to single-user mode before you run the ALTER DATABASE statement, and then set it back to multi-user mode when it's completed. This will lock the database and make it available only to the current connection, which will allow you to successfully run the ALTER DATABASE ... COLLATE statement.

您可以使用 SQL Server Management Studio 或 T-SQL 命令这样做.

这篇关于整理错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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