更改数据库中所有列的排序规则 [英] Change collation of all columns in database

查看:232
本文介绍了更改数据库中所有列的排序规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Code for change collation of all columns in database from  "SQL_Latin1_General_CP1_CI_AS" to "Serbian_Latin_100_CI_AI"
for all tables, for all databases and for all columns 





我尝试过:





What I have tried:

Code for change collation of all columns in database from  "SQL_Latin1_General_CP1_CI_AS" to "Serbian_Latin_100_CI_AI"
for all tables, for all databases and for all columns 

推荐答案

基本上使用ALTER TABLE命令更改排序规则。看看:设置或更改列整理| Microsoft Docs [ ^ ]。



但是,你可以看到有很多有关改变它的限制。看看这个简单的方法来改变所有的整理SQL Server中的数据库对象 [ ^ ]解释了如何实际更改排序规则的步骤



或另一个选项是编写数据库脚本使用所需的排序规则创建一个新的。创建数据库和对象后,运行INSERT INTO ... SELECT查询将数据从旧数据库中的表复制到新数据库中。你可以
Basically changing a collation is done with an ALTER TABLE command. Have a look at: Set or Change the Column Collation | Microsoft Docs[^].

However, as you can see there are a lot of constraints concerning changing it. Have a look at this Easy Way to Change Collation of All Database Objects in SQL Server[^] which explains steps how you can actually change the collation

Or another option is to script the database and create a new one with desired collation. After creating the database and the objects, run an INSERT INTO...SELECT query to copy the data from the tables in the old database into the new database. You can


这篇关于更改数据库中所有列的排序规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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