Chapter 11 Quick Reference

To

Do This

Create a DELETE statement in SQL Server Management Studio

Right-click the desired table.

Select Script Table As.

Select Delete To.

Choose your destination.

Remove all rows in a table

Use TRUNCATE TABLE < Table_Name >.

Automatically delete rows from related tables

Add the ON DELETE CASCADE modifier to the relationship definition by selecting the CASCADE modifier in the DELETE rule.

Delete rows from a view

Make sure you remove rows from only one table.

Delete rows from several tables using a view

Implement an INSTEAD OF trigger.

Enhance control and security in delete operations

Encapsulate the DELETE statements in stored procedures.

Perform other actions while deleting data

Implement AFTER triggers on the table.

Control errors during database actions

Use try catch blocks to obtain information from the ERROR_xxx functions.

Delete data from an ADO.NET application

Use the ADO.NET Connection and Command objects.

Control the information displayed to the user when an error occurs

Catch the SqlClient.SqlException class and evaluate the Number value.



Solid Quality Learning, Microsoft Corporation Staff - Microsoft SQL Server 2005 Database Essentials Step by Step
Solid Quality Learning, Microsoft Corporation Staff - Microsoft SQL Server 2005 Database Essentials Step by Step
ISBN: N/A
EAN: N/A
Year: 2006
Pages: 130

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net