DOWNLOAD THE CODE:
Download the Code 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.

End of Article




Post Your Comments Here

You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now

 
 

ADS BY GOOGLE