Home Database Mysql Tutorial SQL Server转换数据库的排序规则

SQL Server转换数据库的排序规则

Jun 07, 2016 pm 04:18 PM
server sort database rule Convert

什么是排序规则? 排序规则指定了表示每个字符的位模式。它还指定了用于排序和比较字符的规则。排序规则具有下面的特征: ◆语言 ◆区分大小写 ◆区分重音 ◆区分假名 要了解服务器当前使用的排序规则,可以在 SQL 查询分析器中运行 sp_helpsort 系统过程。 S

  什么是排序规则?

  排序规则指定了表示每个字符的位模式。它还指定了用于排序和比较字符的规则。排序规则具有下面的特征:

  ◆语言

  ◆区分大小写

  ◆区分重音

  ◆区分假名

  要了解服务器当前使用的排序规则,可以在 SQL 查询分析器中运行 sp_helpsort 系统过程。

  SQL Server 7.0 不支持使用多个排序规则的数据库。因此,在 SQL Server 7.0 中创建的所有数据库均使用默认的排序规则。SQL Server 2000 支持多个排序规则。SQL Server 2000 数据库可使用除默认排序规则以外的其他排序规则。此外,SQL Server 2000 还支持使用排序规则(除数据库创建的排序规则外)的列。

  在 DTS 中使用“使用排序规则”选项的条件

  SQL Server 2000 可包含多个数据库或列,它们可以使用除默认排序规则以外的排序规则。因此,在数据转换服务 (DTS) 中引入了名为“使用排序规则”的新选项。“使用排序规则”选项的行为由要执行的转换的类型决定。如果要在 SQL Server 2000 的两个实例之间传输数据且启用了“使用排序规则”选项,则数据将从源代码页转换到目标代码页。如果没有启用“使用排序规则”选项且 SQL Server 2000 的两个实例中的代码页相同,则会直接传输数据。如果代码页不同,则数据将从源代码页转换到目标代码页。但是,在传输数据时,转换可能会出现错误。

  注意:如果排序规则用于数据本身并且列使用的是 COLLATE 子句,则排序规则很重要。“使用排序规则”选项确定当数据从一个排序规则传输到另一个排序规则时是否转换代码页。“使用排序规则”选项不会影响是否设置了列定义的 COLLATE 属性。因此,如果源表包含使用 COLLATE 子句创建的带有特定排序规则的列,则此排序规则将在传输数据时得以保留,而不管是否在数据转换服务向导中启用了“使用排序规则”选项。

  不改变数据库排序规则的转换方法

  下列方法不改变数据库的排序规则:

  ◆备份和还原:在某服务器上还原数据库时,如果该服务器使用的排序规则与用于备份的服务器使用的排序规则不同,则不会将还原后的数据库转换为使用新的排序规则。数据库排序规则仍保持原样。

  ◆分离和重新附加:如果分离使用某一排序规则创建的数据库,并且将该数据库重新附加到使用其他排序规则的另一服务器,则该数据库的排序规则不会改变。数据库的排序规则仍保持原样。

  ◆复制数据库向导:复制数据库向导实质上使分离和重新附加的过程自动化了。数据库的排序规则仍保持原样。

  注意:复制数据库向导仅在 SQL Server 2000 中可用。

  在 SQL Server 7.0 中转换数据库的排序规则

  要在运行 SQL Server 7.0 的两台计算机之间更改数据库的排序规则,必须在目标服务器上创建用户数据库和所有对象,然后使用 DTS 或 bcp 实用工具传输数据。

  要将数据库从运行 SQL Server 7.0 的计算机传输到运行 SQL Server 7.0 且具有另一排序规则的计算机,请按照下列步骤操作:

  1.备份源数据库。

  2.使用 SQL Server 企业管理器为源数据库中的所有对象创建脚本。

  3.要从数据库的所有表中导出数据,请使用 DTS 或 bcp 实用工具。

  4.使用 SQL Server 企业管理器或 CREATE DATABASE 语句在目标服务器上创建新的数据库。

  注意:当使用 CREATE DATABASE 语句时,数据库将使用与运行 SQL Server 7.0 的计算机相同的排序规则。

  5.使用 SQL 查询分析器来运行在步骤 2 中创建的脚本,以便在目标数据库中重新创建所有对象。

  注意:此表和列将使用与运行 SQL Server 7.0 的计算机相同的排序规则。

  6.使用 DTS 或 bcp 实用工具将数据导入到目标表中。

  将 SQL Server 7.0 中数据库的排序规则转换为 SQL Server 2000 中的排序规则

  要在 SQL Server 7.0 和 SQL Server 2000 之间更改数据库的排序规则,必须在传输数据之前,在目标服务器上使用适当的排序规则创建数据库、列或同时创建数据库和列。但是,在将数据从 SQL Server 7.0 传输到 SQL Server 2000 时,可以使用 DTS 删除并重新创建对象。因此,在执行此操作时,必须在 DTS 中启用“使用排序规则”选项。

  注意:请不要使用 SQL Server 7.0 中的 DTS 实用工具与运行 SQL Server 2000 的计算机相互传输所有对象。如果必须在 SQL Server 7.0 和 SQL Server 2000 之间传输数据,则必须使用 SQL Server 2000 中的 DTS 实用工具。

  要将 SQL Server 7.0 中数据库的排序规则转换为 SQL Server 2000 中的排序规则,请按照下列步骤操作:

  1.备份源数据库。

  2.使用 SQL Server 企业管理器为源数据库中的所有对象创建脚本。

  3.如果列必须使用其他排序规则,而不使用目标数据库上的默认排序规则,请对脚本中相应列的排序规则进行必要的更改。

  4.使用适当的排序规则在目标服务器上创建新的数据库。

  5.使用 SQL 查询分析器在目标服务器上运行在步骤 2 中创建的脚本,以便在数据库中重新创建所有对象。

  注意:新表和列使用与数据库相同的排序规则,除非您为这些列指定了其他排序规则。

  6.使用 DTS 或 bcp 实用工具传输数据。

  注意:如果使用 DTS,请验证下列信息:

  ◆确保在将数据从 SQL Server 7.0 传输到 SQL Server 2000 时启用了“使用排序规则”选项。

  ◆因为已在目标服务器上使用适当的排序规则创建了对象,所以要禁用“首先创建目标对象”选项。

  在 SQL Server 2000 中转换数据库的排序规则

  要在 SQL Server 2000 中转换数据库的排序规则,请按照下列步骤操作:

  1.备份源数据库。

  2.注意所有列是否使用 COLLATE 子句。

  3.使用适当的排序规则在目标服务器上创建新的数据库。

  4.如果没有列使用 COLLATE 子句,请使用 DTS 将数据传输到目标服务器。为此,请启用“使用排序规则”选项以进行代码页转换,,并将数据转换为目标数据库上的新排序规则。如果所有列均使用 COLLATE 子句,请按照下列步骤操作:

  a.为所有对象(不包括索引、触发器、主键、外键、默认设置和约束)生成脚本。此外,确保启用了“仅为与 7.0 版兼容的功能编写脚本”选项,以便从脚本删除 COLLATE 子句。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How does Go language implement the addition, deletion, modification and query operations of the database? How does Go language implement the addition, deletion, modification and query operations of the database? Mar 27, 2024 pm 09:39 PM

Go language is an efficient, concise and easy-to-learn programming language. It is favored by developers because of its advantages in concurrent programming and network programming. In actual development, database operations are an indispensable part. This article will introduce how to use Go language to implement database addition, deletion, modification and query operations. In Go language, we usually use third-party libraries to operate databases, such as commonly used sql packages, gorm, etc. Here we take the sql package as an example to introduce how to implement the addition, deletion, modification and query operations of the database. Assume we are using a MySQL database.

Quickly learn about ASCII value conversion in PHP Quickly learn about ASCII value conversion in PHP Mar 28, 2024 pm 06:42 PM

ASCII value conversion in PHP is a problem often encountered in programming. ASCII (American Standard Code for Information Interchange) is a standard encoding system for converting characters into numbers. In PHP, we often need to convert between characters and numbers through ASCII code. This article will introduce how to convert ASCII values ​​in PHP and give specific code examples. 1. Change the characters

Detailed tutorial on establishing a database connection using MySQLi in PHP Detailed tutorial on establishing a database connection using MySQLi in PHP Jun 04, 2024 pm 01:42 PM

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

How does Hibernate implement polymorphic mapping? How does Hibernate implement polymorphic mapping? Apr 17, 2024 pm 12:09 PM

Hibernate polymorphic mapping can map inherited classes to the database and provides the following mapping types: joined-subclass: Create a separate table for the subclass, including all columns of the parent class. table-per-class: Create a separate table for subclasses, containing only subclass-specific columns. union-subclass: similar to joined-subclass, but the parent class table unions all subclass columns.

iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos Jul 18, 2024 am 05:48 AM

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

Advanced sorting of PHP arrays: custom comparators and anonymous functions Advanced sorting of PHP arrays: custom comparators and anonymous functions Apr 27, 2024 am 11:09 AM

In PHP, there are two ways to sort an array in a custom order: Custom comparator: implement the Comparable interface and specify the comparison rules of the two objects. Anonymous function: Create an anonymous function as a custom comparator to compare two objects against a criterion.

An in-depth analysis of how HTML reads the database An in-depth analysis of how HTML reads the database Apr 09, 2024 pm 12:36 PM

HTML cannot read the database directly, but it can be achieved through JavaScript and AJAX. The steps include establishing a database connection, sending a query, processing the response, and updating the page. This article provides a practical example of using JavaScript, AJAX and PHP to read data from a MySQL database, showing how to dynamically display query results in an HTML page. This example uses XMLHttpRequest to establish a database connection, send a query and process the response, thereby filling data into page elements and realizing the function of HTML reading the database.

How to handle database connection errors in PHP How to handle database connection errors in PHP Jun 05, 2024 pm 02:16 PM

To handle database connection errors in PHP, you can use the following steps: Use mysqli_connect_errno() to obtain the error code. Use mysqli_connect_error() to get the error message. By capturing and logging these error messages, database connection issues can be easily identified and resolved, ensuring the smooth running of your application.

See all articles