Have to run same queries against many servers (30+), use CURSOR or LOOP I have to do the following 30 times
connect to server with unique IP using TSQL
download a table to temp table
do some query on the temp table (same query 30times)
at end union all the tables for a final solution
Would loop or cursor or some other approach be a better approach?  I don't want to copy paste similar SQL 30 times but that is also an option.
I am currently using linked server to connect to each server
Connecting to other instances without Linked Servers is not convenient unless you use Registered Servers or Central Management Server.
If you have registered servers or CMS, you can execute the same query against all the instances in a group (or all registered servers) at once via SSMS (see the links above). But I don't know if you can output the results to a single table in one instance; you may be stuck with copy &amp; paste to Excel.
If you're willing to go with Powershell, the dbatools module has a very convenient solution in Invoke-DbaQuery.
Invoke-DbaQuery -Query &quot;select fields from table&quot; -SqlInstance instance1,instance2,instance3 will return an object representing the results of the query plus a field with the corresponding instance name that each returned record came from.
From there, you can filter the results with Where-Object, or you can copy the results into a table in another instance with Write-DbaDbDataTable