Chapter 10 Quick Reference

To

Do This

Create an INSERT statement in SQL Server Management Studio

Right-click the desired table.

Select Script Table As

Select Insert To

Choose the desired destination.

Insert a blank row

Ensure that you have default values for all of the columns .

Execute INSERT INTO < Table_Name > DEFAULT VALUES.

Insert values from another table

Execute INSERT INTO < Table_Name > (< columnlist >) SELECT < Matching_column_List > from < Source_Table_name >.

Insert values using views

Ensure that you are only inserting values for columns in a single table.

Insert values using views to more than one table

Implement an INSTEAD OF trigger on the view to insert the values in the different tables appropriately.

Import data from files

Use the BCP utility.

Use Integration Services to fine-tune your import process.

Enhance control and security in insert operations

Encapsulate the insert commands in stored procedures.

Perform other actions while inserting data

Implement an AFTER trigger on the table.

Control errors during database actions

Use TRY CATCH blocks to obtain information from the ERROR_x functions.

Insert data from an ADO.NET application

Use the ADO.NET Connection and Command objects.



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