Finance

Charts

Statistics

Macros

Search

SQL: Inserting Records Using INSERT Action Queries in Excel VBA

The INSERT statement is used to add new records to a database table.

Example:

SQLCommand = "INSERT INTO personen " & _
             "(name, vorname, personalnummer, gehalt, geburtstag) " & _
             "VALUES('Moyo', 'Yannick', 4711, 2900, '02.01.19976')"

This command inserts a new record into the personen table.

  • The field names in parentheses specify the number and order of the values listed after VALUES, which must match.
  • Note the use of single quotes around string and date values — these are mandatory in SQL.
  • When inserting data, the same types of errors can occur as with updates, such as violating data types, null constraints, or unique indexes.
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