SQL Server 2005排序规则问题 [英] SQL Server 2005 collation issue

查看:49
本文介绍了SQL Server 2005排序规则问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个表,它们使用不同的排序规则。不允许连接具有不同归类的表中的列,例如,不允许使用以下SQL

I have two tables, and they are using different collations. It is not allowed to concatenate columns from tables with different collations, for example the following SQL is not allowed,

select table1column1 + table2column2 from ...

我的问题是,如何在不破坏表数据的情况下更改表的排序规则

My question is, how to change the collation of a table without destroying the data of the table?

先谢谢了,
George

thanks in advance, George

推荐答案

如果需要,可以随时更改列排序规则。

You can change columns collation on the fly if you need to.

例如

select table1column1 collate database default  + table2column2 collate database default from ...

数据库默认值可以是您要使用的排序规则。

"Database default" could be whatever the collation you are wanting to use.

您可以使用

ALTER TABLE ... ALTER COLUMN Table1Column1
            varchar(50) COLLATE Latin1_General_CI_AS NOT NULL
GO

这篇关于SQL Server 2005排序规则问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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