Search code examples
azure-data-explorerkqlkusto-exploreradx

how to insert multiple rows using .set-or-append using KQL


sample query

I am trying to insert multiple rows using .set-or-append command in Kusto table. Will this command support multiple rows insertion?. If yes, how can i do that.

I want to insert 2 machines data named "IQVIA","GENE_S" at once using this .set command.


Solution

  • you can use the union operator.

    for example:

    .set-or-append TargetTable <| 
        union
        (print x = "hello", y = "world", when = now()),
        (print x = "_foo_", y = "_bar_", when = ago(5m))
    

    alternatively, you can create a file that includes all of the records you wish to ingest, then ingest that file.