Forum Discussion

zelenskya's avatar
zelenskya
Occasional Contributor
13 years ago

SQL Query results export (CreateADOQuery, exec xp_cmdshell bcp)

Hello!

I'm trying to execute SQL-query which export the result to txt-file:

var Qry = ADO.CreateADOQuery();

Qry.SQL = "exec xp_cmdshell \'bcp \"SELECT * FROM EpicorDBEtalon.dbo.COA\" queryout \"c:\\sqlout.txt\" -c -Usa -P!****1\'";

Qry.Open();



Result: [object Error]: Parameter object is improperly defined. Inconsistent or incomplete information was provided



The same query is successfully executed in SQL Server Management Studio. Also simple queries are successfully executed from TestComplete script.



Please, advice. Probably there are another objects in TestComplete which support queries of this type.