Is it possible to run query to restore SQL database via UI Path?

Hi guys, is it possible to run query to restore SQL database via UI Path as it’s non-query?
I am newbee to UI Path, tried connection to SQL DB and run SQL query.
Thanks!

@yuk.tsang.w8

Yes, It is possible.
First you need to install below package.


Secondly you need configure your connection with SLQ DB, use wizard mode and thing will be much easier.
Once you have a connection string, execute your query via, see below

Thank you so much Lakshay, what if I need to restore log files to another directory on server?
I am actually trying to make it a daily job so the DB can be restored automatically everyday at mid-night.
The daily backup file is named: DB-timestamp.bak, how can I modify the query as the backup file would have different name everyday.
Any wildcard syntax in this case?

@yuk.tsang.w8

You can keep files either on a Shared drive and access it from different location or via
one drive

DatabaseName=“DB-”+now.tostring(“dd-MM-yyyy hh:mm”)
This will give you a dynamic name using time stamp.

Other way is to read from folder i.e.

directory.getfiles(“D:”,"*.bak")
This will give you collection of files.
Iterate through it, use a condition to pick one of those dynamic file

Wildcards

    • 0 or more character
  1. ? 0 or 1 character

Thanks so much @Lakshay_Verma !
Will give it a try first!
Good day!

1 Like

@yuk.tsang.w8
Good Day mate :slight_smile: