All Products
Search
Document Center

Tablestore:Delete a data table

Last Updated:Aug 19, 2024

You can call the DeleteTable operation to delete a data table from an instance.

Note

For more information, see DeleteTable.

Usage notes

  • You cannot restore deleted data tables. Proceed with caution.

  • When you delete a data table, the data in the data table and the secondary indexes that are created for the data table are deleted. You cannot restore deleted data or secondary indexes. Proceed with caution.

Prerequisites

API operation

 /// <summary>
 /// Delete a data table based on the table name. 
 /// </summary>
 /// <param name="request">Request parameter, including the table name.</param>
 /// <returns>Information returned by DeleteTable. The result is null. 
 /// </returns>
 public DeleteTableResponse DeleteTable(DeleteTableRequest request);

 /// <summary>
 /// The asynchronous mode of DeleteTable. 
 /// </summary>
 public Task<DeleteTableResponse> DeleteTableAsync(DeleteTableRequest request);
            

Examples

The following sample code provides an example on how to delete a data table:

 var request = new DeleteTableRequest("SampleTable");
 try
 {
     otsClient.DeleteTable(request);
     Console.Writeline("Delete table succeeded.");
 }
 catch (Exception ex)
 {
     Console.WriteLine("Delete table failed, exception:{0}", ex.Message);
 }
            

References

  • For more information about the API operation, see DeleteTable.

  • If an error occurs when you call this operation, search for the error cause in Error codes based on the error message and troubleshoot the error.