Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Is there a way to write a SQL Query into a TXT file and execute it from PBI?

Dear PBI users, good afternoon.   Currently we are analyzing dividing the development team into front-end - UI / UX design (mostly focusing on the PBI charts , UI and overall UX) and Back-end (SQL ...
  • ThxAlot's avatar
    3 years ago

    I managed to apply the same mode in our team last year, i.e. we use PQ to read sql files stored in a centralized sql depository; we are able to compile sql easily.

    let
        // applicable to .txt / .sql files
        Source = "C:\Users\Home\Downloads\Qry.sql",
        SqlContent = Text.Combine(Table.ToColumns(Csv.Document(File.Contents(Source))){0}, "#(lf)")
    in
        SqlContent

  • ThxAlot's avatar
    ThxAlot
    3 years ago
    Sql.Database("server", "database", [Query=SQLContent])