• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

5.3. Deleting Records

The CFQUERY tag can be used to delete records from a data source using the SQL DELETE clause. You can use DELETE to delete a single record or multiple records, depending on how you write the code. Once a record has been deleted, it can't be recovered, so be extremely careful when writing code that deletes records, as it is quite easy to accidentally delete the contents of an entire table. Because of this, I recommend testing your code against a test database or a temporary table before deploying it in a live application.

5.3.1. Deleting a Single Record

Deleting a single record is as simple as it gets. The SQL for the delete looks something like this:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint