How to execute this SQL query in uipath


I am having a following datatable attached as image.

so when i try to execute the following query using assign activity am getting error message.

Select Id, case when dtk1 = lag(dtk1,1) and dtk2 = lag(dtk2,1) and dtk3 = lag(dtk3,1) and dtk4 = lag(dtk4,1) then id + ’ ’ + lag(Id,1) Else ID end as ConcatenatedID, DTK1,DTK2,DTK3,DTK4
Order by id

getting error.


1 Like

Which database are you connecting to ? Does the query work in the DB Client (Eg: For MS SQL its SSMS).


I want to execute this query in my virtual datatable in studio.

yea ms sql.

If it’s MS SQL try executing the Query in SSMS first. SSMS will give you more relavent error & provide you intellisense.


Actually, am not connecting to DB, i am just reading a data from excel and convert it as Datatable. From the converted datatable i want to execute the query mentioned and filter out the datatable.

1 Like

We can use excel as database
And so we can use database activity like execute query to execute the sql activity we have
For example

Kindly try this and let know for any queries or clarification
Cheers @monish06