Forum Discussion
Same Query Across Multiple Servers
- 9 years ago
Hi,
What you need is a query with all server names you want to get server information for. Then you can create a function in Power Query / Power BI query editor like below
let
Source = (ServerName as any) => let
Source = Sql.Database(ServerName, "master", [Query="SELECT#(lf) SERVERPROPERTY('MachineName') AS [ServerName],#(lf) SERVERPROPERTY('ServerName') AS [ServerInstanceName],#(lf) SERVERPROPERTY('InstanceName') AS [Instance],#(lf) SERVERPROPERTY('Edition') AS [Edition],#(lf) SERVERPROPERTY('ProductVersion') AS [ProductVersion],#(lf) Left(@@Version, Charindex('-', @@version) - 2) As VersionName"])
in
Source
in
SourceAbove query is using ServerName parameter. Once you have the function, you can invoke function in query editor, chosse servername column as the value for function. which will enable you run that function for all servers at the same time.
Hope that helps!
Thanks,
Prathy
This sorta worked, but I appended the query due to multiple servers that needed this query to run on and create a single table
Trying to do the same thing with MySQL. Getting this error:
Formula.Firewall: Query 'ENTMYSQLCC' (step 'Appended Query') references other queries or steps, so it may not directly access a data source. Please rebuild this data combination.