CHAPTER 8

image

Inserting, Updating, Deleting

by Andy Roberts

In this chapter, I review how to modify data using the Transact-SQL INSERT, UPDATE, DELETE, and MERGE statements. I’ll review the basics of each statement and cover specific techniques such as inserting data from a stored procedure and outputting the affected rows of a data modification.

Before going into the new features, let’s start the chapter off by reviewing basic INSERT concepts.

The simplified syntax for the INSERT command is as follows:

INSERT [ INTO]table_or_view_name [ ( column_list ) ] VALUES (({DEFAULT | NULL | expression } [ ,...n ]) [ ,...n ])

Table 8-1 describes the arguments ...

Get SQL Server 2012 T-SQL Recipes: A Problem-Solution Approach 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.