@rameezimtiaz
edit: you donât need the local ODBC connector on your PC.
edit2: of course edit the credentials with your own database settings and credentials 
Ok, i might went a bit over the top with it, but i think you will a good impression on the SQL connection and how to use it. I added some notations to the objects. If something isnât clear, just let me know.
Example: see attachment: UI_SQL_example.zip (20.7 KB)
I have setup 2 examples in it.
- single usage. if you need to run just 1 query.
- multi usage. If you need to run multiple queries you donât want to set the connection everytime. You can use the Connection acitvity and just output the connection string into a variable, so you can reusage the connection string again.
- note: the credentials used in this example are fake. But it will give the impression
- note: please donât use credentials in plain text. This is only used just to give the example.
Secure them by using the Windows credential manager or when using orchestrator set them as
Credentials in Your Assets!!!
what do you need?:
SQL server (+ instance if present) > ask your IT department
SQL databaseName
SQL databaeUserName
SQL databaseUserPassword
SQL tables to query on
examples used:
create table WKV_TEST1 (
id int identity(1,1),
name varchar(200) not null,
primary key (id)
);
create table WKV_TEST2 (
id int identity(1,1),
name varchar(200) not null,
primary key (id);
)
Some testdata:
insert into WKV_TEST1 (name) select âTable 1 testâ;
insert into WKV_TEST2 (name) select âTable 2 testâ;
UiPath Activity:
UiPath Activity: UiPath.Database.Activities
in my example. i have an SQL server in my homelab.
Server (DataSource): sql.homelab.lan (no separate database instance present)
databaseName (Initial Catalog): WKV
databaeUserName (User ID): wkv_user (role: db_owner)
databaseUserPassword (Password): Hbn3h46wuReX
I made 2 xaml files of the below options.
SQL_MultiUse.xaml
SQL_SingleUse.xaml
**1. [SQL_MultiUse] Manual setup (multi use).
I donât like wizards, so i always use the manual option. Set it once and output it to a variable, so i can use it in the
whole project
That would result in this connectionString
âData Source=sql.homelab.lan;Initial Catalog=WKV;Persist Security Info=True;User ID=wkv_user;Password=Hbn3h46wuReXâ
2. [SQL_SingleUse] use the wizard.
This option can be used when you only need to run 1 query. Quick and dirty ;). See the screenshots on how to use this:
Fig 1.
Fig 2.
Fig 3.

Fig 4.
Test the setup
In the Main.xaml i attached both that they will run after eachother. Just test/play with it. Or run the other xaml files separate (Run File)
Some result outputs
|
| 
and what does SQL management studio say:

Troubleshooting:
- connection refused? > Check with SQL Management Studio if your credentials are correct and the firewall is open for incoming connections to the SQL database
- anything else? Give as much information as possible. Comments like âdoesnât workâ i donât take serious;)
You can set the connection string manually, or use the wizard