Update Grams

SQL Server supports XML-based insert, update, and delete operations in much the same way as T-SQL does. Any number of records can be modified, added, or removed using the insert, update, and delete commands.

The Update Gram Standard Format

The standard format of an update gram is

<sql:sync xmlns:sql="urn:schemas-microsoft-com:xml-sql">

<sql:Before>
<TableName [sql:id="Value"] Col="Value" Col="Value".../>
</sql:Before>

<sql:After>
<TableName [sql:id="Value"] [sql:at-identity="Value"]
Col="Value" Col="Value".../>
</sql:After>

</sql:sync>

Following is a basic breakdown of this syntax.

Sync, Before, and After are keywords that have been defined in the sql namespace. The first <sync> tag points to the beginning of a procedure to be ...

Get Writing Stored Procedures for Microsoft SQL Server now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.