Unicode Native Format

Administering SQL Server

Administering SQL Server

Unicode Native Format

The -N switch (or widenative value for the DATAFILETYPE clause of the BULK INSERT statement) uses native (database) data types for all noncharacter data, and Unicode character data format for all character (char, nchar, varchar, nvarchar, text, and ntext) data.

Storing information in Unicode native format is useful when information must be copied from one Microsoft® SQL Server™ installation to another. Using native format for noncharacter data saves time, preventing unnecessary conversion of data types to and from character format. Using Unicode character format for all character data prevents loss of any extended characters when bulk loading data between servers using different code pages. However, a data file in Unicode native format can be read only by the bcp utility and the BULK INSERT statement.

For example, the command to bulk copy the sales table in the pubs database to the Sales.dat data file using Unicode native data format is:

bcp pubs..sales out Sales.dat -N -Sservername -Usa -Ppassword

sql_variant data stored as a SQLVARIANT in a Unicode native mode data file operates the same as it does in a native mode data file, except that char and varchar values are converted to nchar and nvarchar. The original meta data is preserved, and the values are converted back to their original char and varchar data type when bulk copied into the destination column.

See Also

ServerBCPDataFileType Property