Sqlserver
 sql >> Base de Dados >  >> RDS >> Sqlserver

Gravar no arquivo com xp_cmdshell em UTF-8


Finalmente consegui fazer isso gravando a saída em um arquivo temp.txt e adicionando o próximo comando do PowerShell para convertê-lo em UTF-8:
-- Change encoding to UTF-8 with PowerShell 
SET @command = 'powershell -Command "Get-Content 'example@sqldat.com+'\temp.txt -Encoding Unicode | Set-Content -Encoding UTF8 'example@sqldat.com+'\'example@sqldat.com+'"';
EXEC xp_cmdshell @command;