Originally, I created my SQL Server database on a local computer. I set its collation to Latin1_General_CI_AI
and everything worked well. When I moved the finished work to the web hosting SQL Server, I encountered problem: they use a different database collation. So what can I do now?
最初,我在本地计算机上创建了SQL Server数据库。我将其整理设置为Latin1_General_CI_AI,一切运作良好。当我将完成的工作移动到托管SQL Server的Web时,我遇到了问题:它们使用不同的数据库排序规则。那我现在该怎么办?
To be more specific, I need Latin1_General_CI_AI
, but they have Czech_CI_AS
. These two differ significantly when comparing strings in Czech language (surprisingly I need latin1 general, not Czech, to get correct results.)
更具体地说,我需要Latin1_General_CI_AI,但他们有Czech_CI_AS。在比较捷克语的字符串时,这两者有很大不同(令人惊讶的是,我需要latin1 general,而不是Czech,才能获得正确的结果。)
When I tried to change collation of my database, the server complained that I don't have user permission to do that. I tried to contact support desk, but no luck. Can I help myself?
当我尝试更改数据库的排序规则时,服务器抱怨我没有用户权限来执行此操作。我试着联系支持台,但没有运气。我能帮助自己吗?
I know that possibly each single table column can have its own collation, so maybe I should set up all my string columns to Latin1_CI_AI
. But I don't know how to do this. I have only SQL access to the database (unfortunately no SQL Server Management Studio).
我知道可能每个单独的表列都有自己的排序规则,所以也许我应该将所有字符串列设置为Latin1_CI_AI。但我不知道该怎么做。我只有SQL访问数据库(不幸的是没有SQL Server Management Studio)。
1 个解决方案
#1
17
To change the database's collation
更改数据库的排序规则
ALTER DATABASE MyDataBase COLLATE [NewCollation]
To change the collation of a column
要更改列的排序规则
ALTER TABLE MyTable ALTER COLUMN Column1 [TYPE] COLLATE [NewCollation]
#1
17
To change the database's collation
更改数据库的排序规则
ALTER DATABASE MyDataBase COLLATE [NewCollation]
To change the collation of a column
要更改列的排序规则
ALTER TABLE MyTable ALTER COLUMN Column1 [TYPE] COLLATE [NewCollation]