Hi All
Any help greatfully received.
Need to use TO_CHAR function but I cant get the ole provider
to pass the double quotes needed for the TO_CHAR arguments.
The error returns "Column (%d/%m/%y %T) not found in any table in the query (or SLV is undefined)."
the sql works fine using SQL editor/studio, etc but not when passed via OLE
Any help greatfully received.
Need to use TO_CHAR function but I cant get the ole provider
to pass the double quotes needed for the TO_CHAR arguments.
The error returns "Column (%d/%m/%y %T) not found in any table in the query (or SLV is undefined)."
the sql works fine using SQL editor/studio, etc but not when passed via OLE
Code:
Option Explicit
Dim cn, rc,strDSN,sql1
Set cn = CreateObject("ADODB.Connection")
Set rc = CreateObject("ADODB.Recordset")
strDSN = "Provider=Ifxoledbc.2;Password=Password;Persist Security Info=True;" _
& "User ID=UserName;Data Source=dbname@ol_server;Extended Properties=""DB_LOCALE=en_us.819""
cn.Open(strDSN)
sql1 = "SELECT first 10 TO_CHAR(evtime,""%d/%m/%y %T"") from log"
WScript.Echo sql1
'SQL echoed out works when pasted in to SQL Editor, etc.
rc.Open sql1, cn,3,3
WScript.Echo Err.Number & " _ " & Err.Description
rc.Close
cn.Close
Set cn=Nothing
Set rc = Nothing
Set sql1 = Nothing
Set strDSN = Nothing