Skip to content

Latest commit

 

History

History
47 lines (35 loc) · 2.08 KB

File metadata and controls

47 lines (35 loc) · 2.08 KB
title UPDATE, DELETE, and INSERT Statements | Microsoft Docs
ms.custom
ms.date 01/19/2017
ms.prod sql
ms.prod_service connectivity
ms.reviewer
ms.technology connectivity
ms.topic conceptual
helpviewer_keywords
updating data [ODBC], about updating data
DELETE [ODBC]
UPDATE [ODBC]
INSERT [ODBC]
data updates [ODBC], about data updates
ms.assetid 5004ea72-4c49-4064-9752-f7032ba7f133
author David-Engel
ms.author v-daenge

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.