This works but not in utf-8:
sqlcmd -S Server -d DB -E -s, -W -i "C:\Localdata\test.sql" | findstr /V /C:"-" /B > "C:\Localdata\Test.csv"
Would anybody like to help fix this into utf-8?
This works but not in utf-8:
sqlcmd -S Server -d DB -E -s, -W -i "C:\Localdata\test.sql" | findstr /V /C:"-" /B > "C:\Localdata\Test.csv"
Would anybody like to help fix this into utf-8?
add -f 65001
to the sqlcmd command. (or -f o:65001
if you want UTF-8 output, -f i:65001
for UTF-8 input)
But it's not UTF-8.
sqlcmd automatically recognizes both big-endian and little-endian Unicode input files. If the -u option has been specified, the output will always be little-endian Unicode.
And thus, for instance, it disables using diff tool to compare output.
To overcome this M$ "comfort" with tool - use iconv:
iconv -t UTF-8 <sqlcmd.output.csv>
At Windows as "comfortable" М$ product again - you can use iconv from Git command line tool bundle, for instance.