Bulk Import or export data format--Unicode native format

Source: Internet
Author: User

Bulk Import or export data format--Unicode native Format


Application Scenarios


The Unicode native format is useful when you must copy information from one Microsoft SQL Server to another .


using native formats for non-character data can save time and eliminate unnecessary data type conversions from character formats. When you bulk transfer data between servers that use different code pages, Unicode character formatting is used for all character data to prevent any loss of extended characters. Data files in Unicode native format can be read by any bulk import method.

The Unicode native format is recommended when you bulk transfer data between multiple instances of SQL Server by using data files that contain extended characters or DBCS characters. for non-character data, the Unicode native format uses the native (database) data type. Unicode native format uses the Unicode character data format for character data such as char, nchar, varchar, nvarchar, text, varchar (max), nvarchar (max), and ntext.

sql_variant data stored as sqlvariant in a Unicode native format data file is operated in the same way as in a native format data file, except that char and varchar values need to be converted to nchar and nvarchar, which makes the affected columns The storage capacity doubled. The original metadata for these values is preserved, and when bulk imports into a table column, the values are converted back to their original char and varchar data types.

Unicode command options in native format


You can use bcp, BULK Insert, or INSERT ... SELECT * from OPENROWSET (BULK ...) imports native format data into the table. For bcp commands or BULK INSERT statements, you can specify the data format on the command line. For INSERT ... SELECT * from OPENROWSET (BULK ...) statement, you must specify the data format in the format file.

The following options support Unicode native format:

Command

Options

Description

Bcp

-N

Enables the bcp utility to use the Unicode native format, which uses the native (database) data type for all non-character data and uses Unicode for all characters (char, nchar, varchar, nvarchar, text, and ntext) data Character data format.

BULK INSERT

DataFileType = 'widenative'

Use Unicode native format for bulk import of data.


Reference:

Https://msdn.microsoft.com/zh-cn/library/ms189941.aspx

This article is from the SQL Server deep dives blog, so be sure to keep this source http://ultrasql.blog.51cto.com/9591438/1628102

Bulk Import or export data format--Unicode native format

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.