How to Delete an Entire Azure Table in One Command
- How to delete an entire Azure table is quite easy.
- I get this question quite often. I normally would not create such a simple post.
- Most developers think they need to delete rows, one row at a time.
- But that isn't true.
- There is support for deleting a whole table.
- Here is the REST-based approach
- Here is the approach using the .NET libraries
// 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");
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)