简体   繁体   English

SQLite到SQL Server 2008的排序规则

[英]SQLite to SQL Server 2008, Collations

Trying to import a database structure from SQLite to SQL Server 2008 R2 Express. 尝试从SQLite导入数据库结构到SQL Server 2008 R2 Express。 How do I define the following SQLite syntax in my SQL Server CREATE TABLE script? 如何在我的SQL Server CREATE TABLE脚本中定义以下SQLite语法?

vendor_no VARCHAR(255) COLLATE NOCASE

I checked the MSDN page on collations but it has way too many entries and many of them look very similar. 我检查了有关排序规则MSDN页面,但该页面有太多条目,而且其中许多看起来非常相似。 The database is in US-English environment if that matters. 如果重要的话,数据库位于美国英语环境中。

SQLlite has only one built-in collation (Binary), 'nocase' just makes the binary collation case-insensitive. SQLlite只有一个内置排序规则(二进制),“ nocase”仅使二进制排序规则不区分大小写。 SQL Server has collations for many different alphabets, most of them in both versions (CI - case insensitive and CS - case sensitive). SQL Server具有许多不同字母的排序规则,大多数版本在两种版本中均有效(CI(不区分大小写)和CS(不区分大小写))。 It's not a great idea to mix collations in SQL Server, as this is prone to errors due to implicit conversion in many operations (eg join, union, etc). 在SQL Server中混合排序规则不是一个好主意,因为由于许多操作(例如,join,union等)中的隐式转换,这很容易出错。

What you can do is check the collation in your databases to make sure is case insensitive: 您可以做的是检查数据库中的排序规则,以确保不区分大小写:

SELECT name, collation_name FROM sys.databases

is likely that this query returns: SQL_Latin1_General_CP1_CI_AS (US English case insensitive) but you just need to make sure it shows something like ... CI ... 该查询可能返回:SQL_Latin1_General_CP1_CI_AS(美国英语不区分大小写),但您只需要确保它显示类似... CI ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM