Platinum Partner
architects,cloud,tips and tricks,azure

How to Delete an Entire Azure Table in One Command

Here's how to delete an entire Azure table:


001

 

I get this question quite often. I normally wouldn't make such a simple post, but:

  1. Most developers think they need to delete rows one row at a time.
  2. And that isn't true.

There is, in fact, support for deleting a whole table.

Sample.cs

// Retrieve storage account from connection string
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
    CloudConfigurationManager.GetSetting("StorageConnectionString"));
  
// Create the table client
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
  
// Delete the table it if exists
tableClient.DeleteTableIfExist("people");

Cheers!

Published at DZone with permission of {{ articles[0].authors[0].realName }}, DZone MVB. (source)

Opinions expressed by DZone contributors are their own.

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}