Skip to content

Latest commit

 

History

History
44 lines (32 loc) · 1.96 KB

update-delete-and-insert-statements.md

File metadata and controls

44 lines (32 loc) · 1.96 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic helpviewer_keywords
UPDATE, DELETE, and INSERT Statements
UPDATE, DELETE, and INSERT Statements
David-Engel
davidengel
01/19/2017
sql
connectivity
conceptual
updating data [ODBC], about updating data
DELETE [ODBC]
UPDATE [ODBC]
INSERT [ODBC]
data updates [ODBC], about data updates

UPDATE, DELETE, and INSERT Statements

SQL-based applications make changes to tables by executing the UPDATE, DELETE, and INSERT statements. These statements are part of the Minimum SQL grammar conformance level and must be supported by all drivers and data sources.

The syntax of these statements is:

UPDATE table-name

SET column-identifier = {expression | NULL}

[, column-identifier = {expression | NULL}]...

[WHERE search-condition]

DELETE FROM table-name[WHERE search-condition]

INSERT INTO table-name[( column-identifier [, column-identifier]...)]

{query-specification | VALUES ( insert-value [, insert-value]...)}

Note that the query-specification element is valid only in the Core and Extended SQL grammars, and that the expression and search-condition elements become more complex in the Core and Extended SQL grammars.

Like other SQL statements, UPDATE, DELETE, and INSERT statements are often more efficient when they use parameters. For example, the following statement can be prepared and repeatedly executed to insert multiple rows in the Orders table:

INSERT INTO Orders (PartID, Description, Price) VALUES (?, ?, ?)  

This efficiency can be increased by passing arrays of parameter values. For more information about statement parameters and arrays of parameter values, see Statement Parameters.