how to drop multiple tables that start with the same string in ADX using Kusto?

Viewed 38

I have 100+ tables in Azure Data Explorer and they all start with the same string. I want to drop them all but it seems like .drop tables string* doesn't work..

How can I drop multiple tables at once?

any help will be appreciated!

1 Answers

you can use the following to generate the text of a .drop tables command, then invoke that text as the 2nd step.

.show tables
| where TableName startswith "MyPrefix"
| summarize cmd = strcat(
    ".drop tables (",
    strcat_array(make_list(strcat("['", TableName, "']")), ","),
    ")"
)
Related