Whatever message this page gives is out now! Go check it out!

DeleteTable

Last update:
May 18, 2026

Description

The DeleteTable function deletes a table and all items present in the table.
For more information, see DeleteTable.

Category

History

ColdFusion (2021 release): Added this function.

Syntax

serviceHandle.deleteTable(requestParameters)

Parameters

See request parameters of DeleteTable.

Example

<cfscript> 
 cred = { 
    "credentialAlias" : "myalias", 
    "vendorName" : "AWS", 
    "region" : "us-east-2", 
    "secretAccessKey" : "xxxxx", 
    "accessKeyId" : "xxxx" 
  } 
  config = { 
    "serviceName" = "DYNAMODB" 
  } 
  dynamo = getCloudService(cred, config) 
  tableName="YearlyProductCatalog" 
  // create a table 
  createTableStruct={ 
      "TableName": "#tableName#", 
      "KeySchema": [ 
          { 
              "AttributeName": "id","KeyType": "HASH" 
          }, 
          { 
              "AttributeName": "title","KeyType": "RANGE" 
          } 
      ], 
      "AttributeDefinitions": [ 
          { 
              "AttributeName": "id", 
              "AttributeType": "N" 
          }, 
          { 
              "AttributeName": "title", 
              "AttributeType": "S" 
          } 
      ], 
      "ProvisionedThroughput": { 
          "ReadCapacityUnits": 10, 
          "WriteCapacityUnits": 10 
      } 
  } 
 
  dynamo.createTable(createTableStruct) 
  sleep(20000) 
 
  // insert an item 
  putItemStruct = { 
      "TableName": "#tableName#", 
      "Item":{ 
          "id": {"N": 550}, 
          "title": {"S": "My Books Title"} 
      }, 
      "ReturnValues": "NONE" 
  } 
  dynamo.putItem(putItemStruct,{"hasType": true}) 
 
  // delete the table 
  deleteTableStruct={ 
    "TableName": "#tableName#" 
  } 
  try{ 
    deleteResponse=dynamo.deleteTable(deleteTableStruct) 
    writeOutput("Table deleted successfully") 
    writeDump(deleteResponse) 
  } 
  catch (any e){ 
    writeOutput("Unable to delete the table") 
    writeDump(e) 
  } 
</cfscript>

Output

Figure: DeleteTable output
DeleteTable output

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page