Proutatis
Proutatis

Reputation: 75

Remove all tables in Azure Table Storage

I know how to remove one table in Azure Table Storage but I don't know how to remove multiple tables. Is it possible?

Upvotes: 2

Views: 2399

Answers (2)

Alex
Alex

Reputation: 13234

You will have to iterate and delete them one by one:

var tableClient = storageAccount.CreateCloudTableClient();
foreach (var table in tableClient.ListTables())
    table.DeleteIfExists();

Or do the same using corresponding methods from the async api.

Upvotes: 7

MikeWo
MikeWo

Reputation: 10985

As far as I know Tables can only be deleted one at a time. The REST API exposed for Delete Table (https://msdn.microsoft.com/en-us/library/azure/dd179387.aspx) includes the table name as part of the URL when you perform the delete. So, it might be possible that an SDK exposes a way to delete multiple tables, under the hood it's going to be doing it one at a time.

Upvotes: 0

Related Questions