Symptoms
You export a table as a CSV file by using Microsoft SQL Server Management Studio (SSMS) or SQL Server Data Tools (SSDT). For example, you export a table into CSV format in a SQL Server Integration Services (SSIS) project.
If you select double quotation marks (") as the text qualifier, and if any records contain double quotation marks, the marks might not be escaped correctly in the output.
Example
Original data |
big”data |
Expected output |
“big””data” |
Actual output |
“big"data” |
Resolution
The fix for this issue is included in the following update for SQL Server:
Cumulative Update 8 for SQL Server 2017
After you install this update, when you export a table by using the CSV format, you need to turn on the “Escape Qualifier" capability by setting its value to True.
The “Escape Qualifier” capability needs to be changed in SSDT for the saved SSIS package when you use the escaping behavior.
The following screenshot shows the details of the EscapeQualifier property:
Notes:
-
The SQL Server Import and Export Wizard has the limitation that you cannot turn on this capability because the EscapeQualifier property is disabled by default.
-
You can only save the SSIS package through the wizard and modify that property through SSDT to get this capability.
-
For more information, see Flat File Custom Properties - SQL Server Integration Services (SSIS) | Microsoft Learn.
About SQL Server builds
Each new build for SQL Server contains all the hotfixes and security fixes that were in the previous build. We recommend that you install the latest build for your version of SQL Server:
Status
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
References
Learn about the standard terminology Microsoft uses to describe software updates.