Query Details

Table Existence

Query

//Checking to see if a table (or tables) exist or not

let hasNonEmptyTable = (T:string, T2:string) 
{ 
   toscalar( 
   union isfuzzy=true 
   ( table(T) | take 1 | count as Count ),
   ( table(T2) | take 1 | count as Count),
   (print Count=0) 
   | summarize sum(Count) 
   ) > 1
};
let TableName = 'AzureActivity';
let TableName2 = 'SecurityEvent';
print  IsPresent=iif(hasNonEmptyTable(TableName,TableName2 ), "present", "not present")

Explanation

The query is checking if two tables, "AzureActivity" and "SecurityEvent", exist and are not empty. It returns whether the tables are present or not.

Details

Rod Trent profile picture

Rod Trent

Released: October 20, 2020

Tables

AzureActivity SecurityEvent

Keywords

Devices,Intune,User

Operators

toscalarunionisfuzzytabletakecountasprintsummarizeiif

Actions