Cloud Zone is brought to you in partnership with:

My name is Bruno Terkaly and I am a Developer Evangelist in Northern California. Over the past few months I have been presenting a wide variety of demos and slides highlighting the wealth of new features in Visual Studio 2008. Bruno is a DZone MVB and is not an employee of DZone and has posted 51 posts at DZone. You can read more from them at their website. View Full User Profile

How to Delete an Entire Azure Table in One Command

10.01.2012
| 2757 views |
  • submit to reddit

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 Bruno Terkaly, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)