Skip to content

Instantly share code, notes, and snippets.

@DeflateAwning
Last active April 23, 2021 21:13
Show Gist options
  • Save DeflateAwning/675428fe9229696b3c920cb49a39970f to your computer and use it in GitHub Desktop.
Save DeflateAwning/675428fe9229696b3c920cb49a39970f to your computer and use it in GitHub Desktop.
PowerQuery custom step to generate a new column containing SQL Insert Statements for the entire table. Useful for loading Temp Tables.
= Table.AddColumn(#"Changed Type", "SQL", each "INSERT INTO TableName (" & Text.Combine(Table.ColumnNames(#"Changed Type"), ", ") & ") VALUES (" & Text.Combine(List.Transform(Record.FieldValues(_), each "'" & Text.From(_) & "'") , ", ") & ")")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment