| || |
run query from file
I'm trying to run a big query (more then 1700 char)
if I write the query into file,
is there a way to run it from the file
I tried few ways unsuccessfully.
is there other way to do it ?
thanks in advanced,
Re: run query from file
If there are mutiple query then...you would need to use ReadLine() for getting the SQL string..and execuitn the query in loop.
sFileName = "C:\Documents and Settings\Sweety\My Documents\QTP\Forums Query\Temp.sql"
Set fso = CreateObject("Scripting.FileSystemObject")
Set fopen = fso.OpenTextFile(sFileName)
strSql = fopen.Readall
Set objConn = CreateObject("ADODB.Connection")
connStr = "Connection string Here"
objConn.ConnectionString = connStr
Set rs = objConn.Execute(strSql)