将 Oracle 数据(和索引)移至 SQL-Server - 数据大写
我正在尝试将数据从 Oracle (10g) 数据库移动到 SQL-Server (2008)。我还希望在 SQL Server 端重新创建索引。然而,在Oracle中,在前两个字段上定义了一个主键,并且它有这样的数据:
VALUE3 FOO4
VALUE4 FOO8
Value4 Foo8
当我将该数据获取到SQL Server时,由于数据重复,它不会创建该索引。 Oracle 考虑了该情况并认为第二条和第三条记录不同。
建议?
I'm trying to move data from an Oracle (10g) database to SQL-Server (2008). I also want the indexes to be re-created on the SQL-Server side. However, in Oracle, there is a primary key defined on the first two fields, and it has data like this:
VALUE3 FOO4
VALUE4 FOO8
Value4 Foo8
When I get that data to SQL Server, it won't make that index, because of duplication of data. Oracle considers the case and thinks the 2nd and 3rd records are different.
Suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题在于 SQL Server 上的排序规则。
排序规则不区分大小写,因此它将“VALUE4”和“Value4”视为同一事物。您需要将排序规则更改为区分大小写,以便能够应用主键约束。
您可以阅读有关它的更多信息,以及如何在本文中更改 SQL Server 上的排序规则。
The issue is the collation on SQL Server.
The collation is case insensitive, so it sees "VALUE4" and "Value4" as the same thing. You need to change the collation to be case sensitive, in order to be able to apply the primary key constraint.
You can read more about it, and how to change the collation on SQL Server in this article.