My bad... I meant EBCIDC. As for the Server, I'm just playing with SQL Server 2005 [Lite]. I would run a test likeOriginally Posted by Tommy
[vba]
'Open ADO Connection
cConn = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Data Source=.\SQLEXPRESS;Initial Catalog=NCS"
Set oConn = CreateObject("ADODB.Connection")
oConn.CommandTimeOut=0
oConn.Open cConn
'Create 2 test Tables, one to hold Unicode
cSQL = "CREATE TABLE [dbo].[N_MaxTest] ( [NMaxVar] NVARCHAR(MAX) NOT NULL );"
oConn.Execute cSQL, ,adExecuteNoRecords
cSQL = "CREATE TABLE [dbo].[MaxTest] ( [MaxVar] VARCHAR(MAX) NOT NULL );"
oConn.Execute cSQL, ,adExecuteNoRecords
text = "This is a Test" & vbcrlf
'insert into both tables
cSQL="INSERT INTO [dbo].[N_MaxTest] ( [NMaxVar] ) VALUES (REPLICATE(CAST(N'" & text & "' AS NVARCHAR(MAX)), 100));"
oConn.Execute cSQL, ,adExecuteNoRecords
cSQL="INSERT INTO [dbo].[MaxTest] ( [MaxVar] ) VALUES (REPLICATE(CAST('" & text & "' AS VARCHAR(MAX)), 100));"
oConn.Execute cSQL, ,adExecuteNoRecords
oConn.Close
[/vba]
and I expected to have the same data in ANSI and Unicode, so that I might retrieve and compare. But both would come out as ANSI, same length.
So, I am assuming I need to set a Code Page [I think 65001 is the code page for utf-8], or have some sort of unicode/ansi conversion method for string data.Stan
P.S. What I would really like to do is insert the unitest.txt [I attached in a zip to a previous post in this thread] into an NVARCHAR field as Unicode.