Downloads
39478.zip

How can I delete multiple records from a table by using a view as the filter?

By using the DELETE operation, you can join a table with a view to delete the matching rows from the table. The code in Listing 2 shows you how to use a view called v1 as a filter to delete rows from a table called t1. The code initially creates two tables and a view, inserts some sample data, then deletes rows from the first table, which has an ID that matches the key of the view.

A Sad Farewell


This month, we say a sad farewell to Answers from Microsoft, which debuted in SQL Server Magazine's September 2001 issue. We at the magazine are grateful to the members of the SQL Server development team for the time they've spent responding to readers' questions and selecting questions and answers for this column. In developing Yukon and working on other projects, the team members face severe time constraints and have decided to discontinue this column. You can still submit questions to the Microsoft SQL Server newsgroups at http://www.microsoft.com/sql/community/newsgroups/default.asp and to SQL Server Magazine's technical forums at http://www.sqlmag.com/forums.