Pass4sure Microsoft 70-649 exam guides
Performing Bulk Copy Operations 640-801 HP0-145 70-646
This lesson describes how to copy large amounts of data quickly, using the SqlBulkCopy object provided by the System.Data.SqlClient namespace and the BULK INSERT SQL statement in SQL Server. In addition to performing an individual bulk copy operation, you will also learn how to perform a set of bulk copy operations wrapped within a transaction.
Why Perform Bulk Copies?
Copying large amounts of data from one database table to another (or from a file to a database table) can take a lot of time and resources if you simply create an application that reads individual rows out of the original data source and then insert the individual rows into the destination data source. To accomplish the task of moving many records (or entire tables) of data, use the .NET Framework and SQL Server bulk copy features, which perform the transfer of the bulk copies more efficiently than transferring individual records.
Lab: Bulk Copying
In this lab you will bulk copy data from one table to another.
Creating Tables to Copy Data into
To demonstrate how to perform a bulk copy operation, you need tables to copy data into. A quick way to create the tables is to use Server Explorer and the Visual Database Tools to do some cutting and pasting! Use the following steps to create CustomerHistory and OrderHistory tables, which you will use to bulk copy the Customer and Order table data into. 70-291 1D0-510 MB6-508
1.In Server Explorer, expand the Tables node for the Northwind database.
2.Right-click the Customers table and select Open Table Definition.
3.Select the first row by clicking the box with the key icon.
4.Press Ctrl+A to select all the rows.
5.Press Ctrl+C to copy them to the clipboard.
6.Right-click the Tables node in Server Explorer and select Add New Table.
7.Select the empty row (not a cell but the entire row) and press Ctrl+V to paste the table definition into the row.
8.Select only the CustomerID row. Right-click the CustomerID row and select Set Primary Key.
9.Save the table and name it CustomerHistory.
10.Repeat these steps with the Orders table, set the OrderID as the primary key, and save the table with the name OrderHistory.
Lesson Summary
Bulk copying provides an efficient way to copy large amounts of data.
The SqlBulkCopy object provides a .NET Framework class to perform bulk copy operations in your application.
The SQL BULK INSERT statement provides a way to perform bulk copy operations using the resources in SQL Server.
Bulk copy operations can be performed from within a transaction.
Lesson Review 190-802 70-290 70-649
The following questions are intended to reinforce key information presented in this lesson. The questions are also available on the companion CD if you prefer to review them in electronic form.
Related posts:
- Pass4sure Microsoft 70-237 exam guides Considerations for Evaluating Your Environment 70-431 70-646 70-236 When establishing...
- Pass4sure Microsoft 70-526 certification testing Creating DataSet Objects NS0-201 70-643 156-215.1 DataSet objects are available...
- Testking 70-400 Microsoft exam study guide Chapter 4: Lesson Review Answers Lesson 1 1. You have...
- Testking demo Microsoft certification exam practice Understanding SQL Server 2005 Editions A major part of the...
- Pass4sure Lastly Microsoft certification exams QUESTION 11 You are a network administrator of Pass4sure ,...