Last active
November 18, 2019 20:55
-
-
Save ImkeF/7f4fca8f7a7334d7fe7fb1ec761711da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let func = | |
// fetches the first N rows in all tables from a database at once and presents them in a compact form | |
(Server as text, Database as text, NumberOfRows as number) as table => | |
let | |
Source = Sql.Database(Server, Database, [CreateNavigationProperties=false]), | |
#"Filtered Rows" = Table.SelectRows(Source, each Value.Is([Data], type table)), | |
#"Added Custom" = Table.AddColumn(#"Filtered Rows", "Custom", each Table.Transpose(Table.DemoteHeaders(Table.Buffer(Table.FirstN([Data],NumberOfRows))))), | |
#"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", Table.ColumnNames(#"Added Custom"[Custom]{0})) | |
in | |
#"Expanded Custom" | |
, documentation = [ | |
Documentation.Name = " Sql.Database_FirstNRowsFromAllTables | |
", Documentation.Description = " fetches the first N rows in all tables (and views) from a database at once and presents them in a compact form | |
" , Documentation.LongDescription = " fetches the first N rows in all tables (and views) from a database at once and presents them in a compact form | |
", Documentation.Category = " AccessingData | |
", Documentation.Source = " local | |
", Documentation.Author = " Imke Feldmann: www.TheBIccountant.com | |
", Documentation.Examples = {[Description = " | |
" , Code = " | |
", Result = " | |
"]}] | |
in | |
Value.ReplaceType(func, Value.ReplaceMetadata(Value.Type(func), documentation)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment