使用 tableDiff 后显示小表的奇数字符

SQLServer tabeDiff 用于同步数据库. 字符已在目标表中找到.我在任何地方都找不到任何东西,有人经历过吗?这是我的场景.它是一个运行它的 .bat 文件.下面是一个源 table.field 值的示例:

SQLServer tabeDiff is being used to sync DB's. The  character has been found in the destination table. I can find nothing on this anywhere, has anyone experienced this? Here is my scenario. Its a .bat file which runs it. Here is an example of a source table.field value:

SM-33®

tableDiff 之后出现在源 table.field 中:

After tableDiff this appears in the source table.field:

SM-33®

这怎么会发生?源是 SQLServer 2008R2,目标是 SQLServer 2005.

How can this be happening? The source is SQLServer 2008R2, destination is SQLServer 2005.

推荐答案

两个数据库是否使用相同的排序规则?我想这就是导致这个问题的原因.您应该确保它们使用相同的排序规则,然后再次运行 tablediff 实用程序.

Are the two databases using the same collation? I would imagine that is what is causing this issue. You should make sure they are using the same collation and then run the tablediff utility again.

更多信息:

  • 使用 SQL Server 排序规则
  • SQL Server 排序规则基础

更改正在使用的生产数据库的排序规则存在一定的风险.您需要确保它不会破坏当前存在的数据.如果所有当前数据都是 ASCII,那么您可能没问题,但如果您遇到此类问题,听起来就不是这样了.

There is a certain amount of risk in altering the collation of an in-use production database. You need to ensure that it isn't going to mangle the data that is currently there. If all of the current data is ASCII you're probably alright, but it doesn't sound like that is the case if you're having problems like this.

这篇文章:Collat​​ion Hell (第 2 部分) 讨论了更改数据库排序规则所涉及的风险.而这个 technet post 描述了您使用的两个排序规则之间的差异.

This post: Collation Hell (Part 2) discusses the risks involved in changing the collation of a database. And this technet post describes the differences between the two collations you are using.

如果不先在生产数据库的副本上进行测试,我不会这样做.我从来没有真正需要修改正在使用的数据库的排序规则,而且我并不是 100% 了解所有排序规则类型之间的差异,所以我真的不能给你具体的建议.进行一些测试以确保您不会进一步损坏您的数据.

I wouldn't do this without testing it on a copy of the production database first. I've never actually needed to modify the collation of a database that is in use and I'm not 100% across the differences between all of the collation types, so I can't really give you specific advice. Do some testing to be sure you're not going to further corrupt your data.

相关文章