Execute the ingestion statment Based on If condition result

ADX 156 Reputation points
2021-11-10T10:55:13.717+00:00

Hi,

Can someone answer how we can write the similar query in ADX.

Sample SQL Server query:

INSERT INTO TestTable(Col1,Col2)
Values(1,10)
Where NOT EXISTS ( SELECT 1 FROM TestTable WHERE col1 =1 and Col2=10)

Thanks

Azure Data Explorer
Azure Data Explorer
An Azure data analytics service for real-time analysis on large volumes of data streaming from sources including applications, websites, and internet of things devices.
503 questions
{count} votes

Accepted answer
  1. PRADEEPCHEEKATLA-MSFT 84,531 Reputation points Microsoft Employee
    2021-11-12T04:11:28.93+00:00

    Hello @ADX ,

    Thanks for the question and using MS Q&A platform.

    Here is the similar ADX query for the above SQL server query:

    .set testTable <| datatable(col1:int, col2:int)[2, 30];  
    .set-or-append testTable <|   
    let c1 = 1;  
    let c2 = 10;  
    let recordFound = testTable  
    | where col1 == c1 and col2 == c2  
    | count;  
    print col1=toint(c1), col2=toint(c2)  
    | where toscalar(recordFound) == 0  
    

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators

0 additional answers

Sort by: Most helpful