Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
I have the following code which efficiently concatenates the same table from several servers/databases. (Thanks again, @Anonymous !!) I added a declaration for some custom SQL. How do I adapt the "Table.SelectRows..." to use the custom SQL in place of the table?
let
TableName = "tblMyData",
CustomSQL = "Select top 10 Col1, Col2, Col4 From tblMyData Where Col5>0",
Source = Table.Combine({
Table.SelectRows(Sql.Database("SQLServer1", "MyDatabase1"), each [Item] = TableName){[Schema="dbo",Item=TableName]}[Data],
Table.SelectRows(Sql.Database("SQLServer2", "MyDatabase2"), each [Item] = TableName){[Schema="dbo",Item=TableName]}[Data],
Table.SelectRows(Sql.Database("SQLServer3", "MyDatabase3"), each [Item] = TableName){[Schema="dbo",Item=TableName]}[Data],
Table.SelectRows(Sql.Database("SQLServer4", "MyDatabase4"), each [Item] = TableName){[Schema="dbo",Item=TableName]}[Data],
Table.SelectRows(Sql.Database("SQLServer5", "MyDatabase5"), each [Item] = TableName){[Schema="dbo",Item=TableName]}[Data]})
in
Source
Solved! Go to Solution.
Hi @Believer
Based on my test, you can try the following code. Sql.Database - PowerQuery M
let
CustomSQL = "SELECT * FROM Table_1 WHERE Provider='a';",
Table1 = Sql.Database("SQLServer1", "Database1", [Query=CustomSQL]),
Table2 = Sql.Database("SQLServer2", "Database2", [Query=CustomSQL]),
Source = Table.Combine({Table1, Table2})
in
Source
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Hi @Believer
Based on my test, you can try the following code. Sql.Database - PowerQuery M
let
CustomSQL = "SELECT * FROM Table_1 WHERE Provider='a';",
Table1 = Sql.Database("SQLServer1", "Database1", [Query=CustomSQL]),
Table2 = Sql.Database("SQLServer2", "Database2", [Query=CustomSQL]),
Source = Table.Combine({Table1, Table2})
in
Source
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |