I wanted to execute the below SQL Script on local SQL Express server:
Select *
from OPENROWSET('Microsoft.ACE.OLEDB.12.0',
'Excel 12.0;HDR=YES;Database=C:\localpath\file.xlsx;',
[Sheet1$])
Query run from SQL Express works fine. But when I try to run it from vbscript:
dim dbconn, ConnectionString
ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=compname\SQLEXPRESS;Database=DB;ID=username;Password="";Extended Properties='Excel 12.0;HDR=YES;IMEX=1;"
Set dbconn = CreateObject("ADODB.Connection")
dbconn.Open ConnectionString
dbconn.Execute("\\path\query.sql")
it displays following error:
Script: Script path
Line: 4
Char: 1
Error: Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
Code: 800A0BB9
Source: ADODB.Connection