简体   繁体   English

使用 Export-Csv (PowerShell) 命令从 SQL 服务器导出数据时双引号被转换为问号 (?)

[英]while exporting data from SQL Server using Export-Csv (PowerShell) command double quotes are converted into question mark (?)

Here is my Table having column "Value"-这是我的表格,其中包含“值”列-

Value价值
This "data").这个“数据”)。 has consists of "information"由“信息”组成
("Party A") and ("Party B") (“甲方”)和(“乙方”)
Invoke-Sqlcmd -ServerInstance 'SQLSERVER' -Database "SQL" -Query "select * from Table" | Export-Csv -Path "C:\Users\Desktop\Outquery.csv" -NoTypeInformation

this code works fine but while exporting the data into CSV file doublequotes are converted into unexpected value with question mark (?)此代码工作正常,但在将数据导出到 CSV 文件时,双引号被转换为带有问号 (?) 的意外值

CSV OUTPUT:- CSV OUTPUT:-

   VALUE
  -------    
 This ?data?). has consists of ?information?
 (?Party A?) and (?Party B?) 

After further research adding "-Encoding UTF8" at the end of the code it is now exporting as expected.经过进一步研究,在代码末尾添加“-Encoding UTF8”后,它现在可以按预期导出。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从 csv 文件中删除双引号,同时使用 sql 服务器中的批量收集将数据插入表中 - Remove double quotes from csv file while inserting data into table using bulk collect in sql server 在 powershell ans SQL Server 中使用 export-csv 时出错 - 转换溢出 - Error using export-csv in powershell ans SQL Server - Conversion overflow 从 SQL 服务器到 PowerShell ISE 更改导出 CSV 文件中的语言 - Change Language in Export-CSV file from SQL Server through PowerShell ISE 如何从SQL Server删除CSV导出中填充的双引号 - How to remove double quotes populating in CSV Export from SQL Server 如何将 sql 服务器查询结果导出到 .csv 文件,数据在导出文件中应使用双引号 SSIS - How to export the sql server query result to .csv file and data should be double quotes in exported file using SSIS 将 SQL 服务器查询结果导出到带有双引号的 csv 文件时,列中出现逗号问题,数据将拆分到下一列 - Issue with commas in the column while exporting SQL Server query result to .csv file with double quotes the data is splitting up to next columns 使用Talend从SQL Server导出到CSV时的日期更改 - Date changes while exporting from sql server to csv using talend 使用ssms将数据从sql server导出为CSV - exporting data from sql server into a CSV using ssms 将数据从 SQL 服务器导出到 csv - Exporting data to csv from SQL Server SQL Server:使用批量导出实用程序将数据导出到csv文件时删除换行符 - SQL Server: removing line breaks when exporting data to csv file using Bulk export utility
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM