Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Good Mornig,
I need to make a SQLServer bulk insert, but SQLServer does not support UTF8(1252) for Bulk insert, and the Qlikview dont Store a txt file in other codepage, just UTF8.
How can i export/store a txt file in codepage ANSI or 65001 ?
QlikView does not support exporting other than utf
You'll have to convert the text file using an editor (like notepad++) or other utility that supports such conversions. Or write a macro that can do such a conversion. As you noticed Qlikview doesn't support other codepages for the STORE command.
QlikView does not support exporting other than utf
This vbs script should do what you need
Option Explicit
Private Const adReadAll = -1
Private Const adSaveCreateOverWrite = 2
Private Const adTypeBinary = 1
Private Const adTypeText = 2
Private Const adWriteChar = 0
Private Sub UTF8toANSI(ByVal UTF8FName, ByVal ANSIFName)
Dim strText
With CreateObject("ADODB.Stream")
.Open
.Type = adTypeBinary
.LoadFromFile UTF8FName
.Type = adTypeText
.Charset = "utf-8"
strText = .ReadText(adReadAll)
.Position = 0
.SetEOS
.Charset = "iso-8859-1"
.WriteText strText, adWriteChar
.SaveToFile ANSIFName, adSaveCreateOverWrite
.Close
End With
End Sub
UTF8toANSI WScript.Arguments(0), WScript.Arguments(1)
Thanks for Reply.
It works well like notepad, but i am looking for a solution with out human intervention, because the qvw will be in a client server. 😕
STORE $(vTabelaAtual)_$(I) INTO $(PathRedeQlikView)\$(vTabelaAtual)_$(I).tmp (txt, delimiter is '#');
|
Hi Marcus,
Where do you get the ConvertUTF8toANSI.exe tool?
Thanks!
Scratch that. I got Bomremover.exe to work.
It's a C# "home maked" program.
if you use the bulk insert like this, it works with utf-8
Note: MSDN documentation says utf-8 is not supported, don't believe it, for me this works perfect in SQL server 2005ff
BULK INSERT YourTable
FROM 'YourCSV.csv'
WITH (
CODEPAGE = '65001', --> UTF-8
FIELDTERMINATOR=';'
);