EXTRACTING THE PARTICULAR COLUMN FROM DT AND STORING INTO VARIABLE AND USING THIS VARIABLE INTO SQL QUERY?

HI Team,

I am stuck in a situation where I need to extract the number of servers from the SQL connection.

I do have a datatable consisting of all the server names only.

What I need is to use some container (mostly a string), so that I have the coma separated pattern as shown below:- strArray1 = " ‘Server A’, ‘Server B’, ‘Server C’, ‘Server D’, ‘Server E’, ‘Server F’ "

And this very same string variable can be passed into the SQL DB query as shown below:-
“SELECT TOP (10000) [ServerName] FROM [ServerInfo].[dbo].[vServersAllDetails] WHERE [ServerName] NOT IN (” +strArray1 +“)”

I hope you understand the scope for the string variable in my case.

Although, I got the solution to this and also tried it, but got an error saying that such a long string of input cannot be passed into a query as a variable.

Also, please feel free to give your inputs in this regard and give any other kind of approach to proceed.

Thanks and Regards,
@hacky

It sounds like you’re attempting a join, but you have one table in uiPath and another in the SQL DB.

If you had both tables in the SQL DB you could use an SQL join. The limitation here is the data you currently have would need to exist as an SQL DB table before the join, and I don’t know if that makes sense with the data youre gathering.

if you had both as data tables in uiPath you could use a Join Data Tables activity. Be sure to be mindful of the limits of the uiPath Datatable object, and that it would be stored in memory so that could cause strain on the system.

I’m not sure the feasibility for either of these approaches for your environment, but they are possibilities to consider.