You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/relational-databases/import-export/use-unicode-character-format-to-import-or-export-data-sql-server.md
@@ -3,8 +3,7 @@ title: "Use Unicode Character Format to Import & Export Data"
3
3
description: The Unicode character data format allows data to be exported from a SQL Server instance by using a code page that differs from the code page used by the client.
4
4
author: rwestMSFT
5
5
ms.author: randolphwest
6
-
ms.reviewer: wiassaf
7
-
ms.date: 06/17/2025
6
+
ms.date: 05/27/2025
8
7
ms.service: sql
9
8
ms.subservice: data-movement
10
9
ms.topic: concept-article
@@ -31,11 +30,9 @@ When using Unicode character format, consider:
31
30
32
31
- The [sql_variant](../../t-sql/data-types/sql-variant-transact-sql.md) data that is stored in a Unicode character-format data file operates in the same way it operates in a character-format data file, except that the data is stored as [nchar](../../t-sql/data-types/nchar-and-nvarchar-transact-sql.md) instead of [char](../../t-sql/data-types/char-and-varchar-transact-sql.md) data. For more information about character format, see [Collation and Unicode support](../collations/collation-and-unicode-support.md).
33
32
34
-
<aid="special_considerations"></a>
35
-
36
33
## Special considerations for Using Unicode character format, bcp, and a format file
37
34
38
-
Unicode character format data files follow the conventions for Unicode files. The first two bytes of the file are hexadecimal numbers, `0xFFFE`. These bytes serve as byte-order marks (BOM), specifying whether the high-order byte is stored first or last in the file. The [bcp Utility](../../tools/bcp-utility.md) might misinterpret the BOM and cause part of your import process to fail; you might receive an error message similar as follows:
35
+
Unicode character format data files follow the conventions for Unicode files. The first two bytes of the file are hexadecimal numbers, 0xFFFE. These bytes serve as byte-order marks (BOM), specifying whether the high-order byte is stored first or last in the file. The [bcp Utility](../../tools/bcp-utility.md) might misinterpret the BOM and cause part of your import process to fail; you might receive an error message similar as follows:
39
36
40
37
```csharp
41
38
Startingcopy...
@@ -48,51 +45,6 @@ The BOM might be misinterpreted under the following conditions:
-Don't use a format file. An example of this workaround is provided below, see [Using bcp and Unicode Character Format to Import Data without a Format File](#bcp_widechar_import).
57
-
58
-
-Usethe `-c` switch instead of `-w`.
59
-
60
-
- Re-export the data using a native format.
61
-
62
-
- Use [BULK INSERT](../../t-sql/statements/bulk-insert-transact-sql.md) or [OPENROWSET BULK](../../t-sql/functions/openrowset-bulk-transact-sql.md). For more information, see [Using BULK INSERT and Unicode Character Format with a Non-XML Format File](#bulk_widechar_fmt) and [Using OPENROWSET and Unicode Character Format with a Non-XML Format File](#openrowset_widechar_fmt).
63
-
64
-
- Manually insert first record in destination table and then use `-F 2` switch to have import start on second record.
65
-
66
-
- Manually insert dummy first record in data file and then use `-F 2` switch to have import start on second record. An example of this workaround is provided below, see [Using bcp and Unicode Character Format to Import Data with a Non-XML Format File](#bcp_widechar_import_fmt).
67
-
68
-
- Use a staging table where the first column is a character data type.
69
-
70
-
- Re-export the data and change the data field order so that the first data field will be character. Then use a format file to remap the data field to the actual order in the table. For an example, see [Use a format file to map table columns to data-file fields (SQLServer)](use-a-format-file-to-map-table-columns-to-data-file-fields-sql-server.md).
71
-
72
-
<a id="command_options"></a>
73
-
74
-
## Command options for unicode character format
75
-
76
-
You can import Unicode character format data into a table using [bcp](../../tools/bcp-utility.md), [BULK INSERT](../../t-sql/statements/bulk-insert-transact-sql.md), or [OPENROWSET BULK](../../t-sql/functions/openrowset-bulk-transact-sql.md). For a [bcp](../../tools/bcp-utility.md) command or [BULK INSERT](../../t-sql/statements/bulk-insert-transact-sql.md) statement, you can specify the data format in the statement. For an [OPENROWSET BULK](../../t-sql/functions/openrowset-bulk-transact-sql.md) statement, you must specify the data format in a format file.
77
-
78
-
Unicode character format is supported by the following command options:
79
-
80
-
|Command|Option|Description|
81
-
|-------------|------------|-----------------|
82
-
| `bcp` |`-w`|Uses the Unicode character format.|
83
-
| `BULK INSERT` |`DATAFILETYPE ='widechar'`|Uses Unicode character format when bulk importing data.|
84
-
| `OPENROWSET` |N/A|Must use a format file.|
85
-
86
-
> [!NOTE]
87
-
> Alternatively, you can specify formatting on a per-field basis in a format file. For more information, see [Format files to import or export data (SQLServer)](format-files-for-importing-or-exporting-data-sql-server.md).
88
-
89
-
<a id="etc"></a>
90
-
91
-
## Example test conditions
92
-
93
-
<a id="sample_table"></a>
94
-
95
-
The examples are based on the sample `myWidechar` table and format file. The script creates a test database, a table named `myWidechar` and populates the table with some initial values. Execute the following Transact-SQL in Microsoft [!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)] (SSMS):
### Use bcpand Unicode characterformat to Export Data
190
140
191
-
### Use bcp and Unicode Character Format to Export Data
141
+
`-w` switch and `OUT` command. The data file created in this example is used in all subsequent examples. At a command prompt, enter the following commands:
192
142
193
-
Use the `-w` switch and `OUT` command.
194
-
195
-
The data file `myWidechar.bcp` created in this example will be used in subsequent examples.
196
-
197
-
Change the location of the code sample from `D:\BCP\myWidechar.bcp` to a file location on your machine.
198
-
199
-
At a command prompt, enter the following commands:
200
-
201
-
```cmd
143
+
```batch
202
144
bcp TestDatabase.dbo.myWidechar OUT D:\BCP\myWidechar.bcp -T -w
### Use bcp and unicode character format to import data with a non-XML format file
235
-
236
-
The `-w` and `-f` switches, and the `IN` command.
164
+
### Use bcp and Unicode character format to Import Data with a non-XML format file
237
165
238
-
[A workaround will need to be used](#special_considerations) since this example involves bcp, a format file, Unicode character, and the first data field in the data file is non-character. The data file `myWidechar.bcp` will be altered by adding an additional record as a "dummy" record which will then be skipped with the `-F 2` switch.
166
+
`-w` and `-f` switches and `IN` command. A workaround needs to be used since this example involves bcp, a format file, Unicode character, and the first data field in the data file is non-character. See [Special Considerations for Using Unicode character format, bcp, and a format file](#special-considerations-for-using-unicode-character-format-bcp-and-a-format-file) earlier in the article. The data file `myWidechar.bcp` is altered by adding an extra record as a "dummy" record which is then skipped with the `-F 2` switch.
239
167
240
168
At a command prompt, enter the following commands and follow the modification steps:
Copy file name to clipboardExpand all lines: docs/t-sql/statements/create-database-scoped-credential-transact-sql.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,7 +56,7 @@ Specifies the name of the account to be used when connecting outside the server.
56
56
- To import a file from Azure Blob Storage using a managed identity, the identity name must be `MANAGED IDENTITY`.
57
57
- When using Kerberos (Windows Active Directory or MIT KDC) do not use the domain name in the `IDENTITY` argument. It should just be the account name.
58
58
- In a SQL Server instance, if creating a database scoped credential with a Storage Access Key used as the `SECRET`, `IDENTITY` is ignored.
59
-
-`WITH IDENTITY` is not required if the container in Azure Blob storage is enabled for anonymous access. For an example querying Azure Blob storage with `OPENROWSET BULK`, see [Import into a table from a file stored on Azure Blob storage](../functions/openrowset-bulk-transact-sql.md#j-use-openrowset-to-access-several-delta-files-from-azure-data-lake-gen2).
59
+
-`WITH IDENTITY` is not required if the container in Azure Blob storage is enabled for anonymous access. For an example querying Azure Blob storage with `OPENROWSET BULK`, see [Import into a table from a file stored on Azure Blob storage](../functions/openrowset-bulk-transact-sql.md#j-use-openrowset-to-access-several-delta-tables-from-azure-data-lake-gen2).
60
60
- In [!INCLUDE [sssql22-md](../../includes/sssql22-md.md)] and later versions, the REST-API connector replaces HADOOP. For Azure Blob Storage and Azure Data Lake Gen 2, the only supported authentication method is shared access signature. For more information, see [CREATE EXTERNAL DATA SOURCE (Transact-SQL)](create-external-data-source-transact-sql.md).
61
61
- In [!INCLUDE [sssql19-md](../../includes/sssql19-md.md)], the only PolyBase external data source that supports Kerberos authentication is Hadoop. All other external data sources (SQL Server, Oracle, Teradata, MongoDB, generic ODBC) only support Basic Authentication.
62
62
- SQL pools in Azure Synapse Analytics include the following notes:
0 commit comments