sql-server - 从 CSV 导出中删除双引号
问题描述
我在 SP 中有以下部分代码,它将一些结果导出到 CSV。我尝试将 ConvertTo-Csv -NoTypeInformation更改为ConvertTo-Csv -NoTypeInformation -Delimiter ",",但它只是不会将文件导出到路径。
SET @cmd = 'Invoke-Sqlcmd -Query ''SELECT * FROM '+@tablename+';'' -Database '+@dbname+' -Server "'+@servername+'" -Username '+@username+' -Password '+@password+
' | ConvertTo-Csv -NoTypeInformation | select -Skip 1 | Set-Content -Path '+@folderpath+'\'+@filename+' -Encoding UTF8'
SET @cmd = 'powershell.exe -noprofile -command "'+@cmd+'"'
EXEC @return = xp_cmdshell @cmd, no_output
IF @return <> 0
BEGIN
PRINT 'ERROR: '+@cmd
END
如何在没有双引号的情况下将其导出?
解决方案
推荐阅读
- android - 如何取消片段导航(使用 NavController)
- firebase - 如何写入 Firestore 模拟器?
- python - SQL Alchemy 查询何时真正对数据库进行查询?
- database - 当另一个发生故障时如何启动一个新的 Logstash 实例
- python-3.x - 我可以从具有多个 Python 链接的网页中解析和导出信息吗?
- python - 如何通过防火墙解决“由于目标机器主动拒绝而无法建立连接”
- c# - 使用 Entity Framework Core 对关系表进行转换
- php - 如何让 PHP 将我的变量视为数字?
- flutter - 如何在颤动中将周,月,年添加到日期
- jakarta-mail - 内容 ID 为空的电子邮件