Run sqlcmd and query database from script

Best practices, code snippets for common functionality, examples, and guidelines.
Zee357
Posts: 8
Joined: Tue Jan 05, 2016 7:43 pm

Run sqlcmd and query database from script

Post by Zee357 » Fri Aug 19, 2016 4:17 pm

Has anyone executed sqlcmd (command-line) utility from a Ranorex automation script and fired a T-SQL script to query the database?

I need to do this in a web application testing scenario that needs to both run SELECTs as well as INSERTs and DELETEs against the back-end SQL Server database.

Thanks.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Run sqlcmd and query database from script

Post by Support Team » Mon Aug 22, 2016 12:01 pm

Hello Zee357,

Since Ranorex is based on C# you could write your own usercode function in order to execute a SQL command, for example: how-to-execute-an-sql-script-file-using-c-sharp

Sincerely,
Robert
.
Image