Over a million developers have joined DZone.

How to Delete an Entire Azure Table in One Command

· Cloud Zone

Download the Essential Cloud Buyer’s Guide to learn important factors to consider before selecting a provider as well as buying criteria to help you make the best decision for your infrastructure needs, brought to you in partnership with Internap.


001

  1. How to delete an entire Azure table is quite easy.
  2. I get this question quite often. I normally would not create such a simple post.
    1. Most developers think they need to delete rows, one row at a time.
    2. But that isn't true.
  3. There is support for deleting a whole table.
  4. Here is the REST-based approach
  5. Here is the approach using the .NET libraries

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");


The Cloud Zone is brought to you in partnership with Internap. Read Bare-Metal Cloud 101 to learn about bare-metal cloud and how it has emerged as a way to complement virtualized services.

Topics:

Published at DZone with permission of Bruno Terkaly, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}