Finance

Charts

Statistics

Macros

Search

SQL: Deleting Records Using DELETE Action Queries in Excel VBA

The DELETE statement is used to remove records from a database table. Its syntax is similar to SELECT. Selection criteria must be carefully specified to avoid deleting unintended records.

Example 1: Deleting All Records

SQLCommand = "DELETE FROM personen"
  • This command deletes all records from the personen table and should generally be avoided unless you really want to clear the entire table.

Example 2: Deleting a Specific Record

SQLCommand = "DELETE FROM personen WHERE personalnummer = 4711"
  • This command deletes exactly one record, since it filters by the unique indexed field personalnummer (personnel number).
0 0 votes
Évaluation de l'article
S’abonner
Notification pour
guest
0 Commentaires
Le plus ancien
Le plus récent Le plus populaire
Online comments
Show all comments
Facebook
Twitter
LinkedIn
WhatsApp
Email
Print
0
We’d love to hear your thoughts — please leave a commentx