Query Details

Does A Table Exist

Query

let hasNonEmptyTable = (T:string) 
{ 
   toscalar( union isfuzzy=true ( table(T) | count as Count ), (print Count=0) | summarize sum(Count) ) > 0
};
let TableName = 'AzureDiagnostics';
print Table=TableName, IsPresent=iif(hasNonEmptyTable(TableName), "Table present", "Table not preset")

Explanation

The query is checking if a table named 'AzureDiagnostics' exists and if it has any data in it. If the table exists and has data, it will print "Table present". If the table does not exist or has no data, it will print "Table not present".

Details

Rod Trent profile picture

Rod Trent

Released: March 26, 2020

Tables

AzureDiagnostics

Keywords

Devices,Intune,User,AzureDiagnostics

Operators

toscalarunionisfuzzytablecountassummarizeiifprint

Actions