This topic describes how to delete a data table from an instance by using Tablestore SDK for .NET.
Usage notes
If a search index is created for a data table, you must delete the search index before you can delete the data table.
If a secondary index is created for a data table, the secondary index is automatically deleted when you delete the data table.
After a data table and its secondary indexes are deleted, they cannot be recovered. Proceed with caution.
Prerequisites
A client is initialized. For more information, see Initialize a Tablestore client.
Method description
public DeleteTableResponse DeleteTable(DeleteTableRequest request)Asynchronous method:
public Task<DeleteTableResponse> DeleteTableAsync(DeleteTableRequest request)Sample code
The following sample code shows how to delete a data table named test_table.
try
{
DeleteTableRequest request = new DeleteTableRequest("test_table");
client.DeleteTable(request);
Console.WriteLine("Delete table succeeded.");
}
catch (Exception ex)
{
Console.WriteLine($"Delete table failed, exception:{ex.Message}");
}