Database Reference
In-Depth Information
Don't forget to put the rowguid column back on the Users table. You can do this by using the same
syntax as before:
ALTER TABLE Users
ADD rowguid uniqeidentifier
Next, let's make this a little simpler and put the export and import together, so you aren't running
the statements one at a time.
Putting the Export and Import Together
You can put the export and import processes together into a single file to make them easier to use. To do
so, open Notepad, and type in the following, replacing the italicized information with the appropriate
information for your environment:
bcp Techbio.dbo.Users out c:\scott\ user.dat -S Scott-PC -U sa -P Password -n -q
bcp Techbio.dbo.Docs out c:\scott\docs.dat -S Scott-PC -U sa -P Password -n -q
bcp Techbio.dbo.UserDocs out c:\scott\userdoc.dat -S Scott-PC -U sa -P Password -n -q
bcp Techbio.dbo.Users in c:\scott\user.dat -S servername.database.windows.net
-U SQLScott@ servername -P #ackThis -n -q
bcp Techbio.dbo.docs in c:\scott\docs.dat -S servername.database.windows.net
-U SQLScott@ servername -P #ackThis -n -q
bcp Techbio.dbo.userdocs in c:\scott\userdoc.dat -S servername.database.windows.net
-U SQLScott@ servername -P #ackThis -n -q
Save the file as AzureBCP.cmd, and navigate to its location. Double-click the file to execute
it. A command window appears, showing the results of the bcp commands that export and import
the data.
As stated earlier, SQL Server BOL is full of information about how to use the bcp utility. This section
is a brief introductory look at how to use this utility to move data from your local SQL Server instance to
SQL Azure. The bcp utility is bulk-copy method of moving data. It lacks SSIS's ability to convert data
from one data type to another, and SSIS's workflow components. But if all you're interested in is moving
data from one table to a similar destination table, bcp is your best friend.
SQL AZURE MIGRATION WIZARD
The tools discussed so far in the chapter are provided by Microsoft. However, a standout third-party utility
is available, which was built specifically for migrating data to SQL Azure. That utility is the SQL Azure
Migration Wizard, and it deserves some well-earned attention.
The goal of the SQL Azure Migration Wizard is to help you migrate your local SQL Server 2005/2008
databases into SQL Azure. This utility is wizard driven, making it very easy to use. It walks you step by step
through all that is required, so migration is simple and nearly seamless.
You can find the SQL Azure Migration Wizard on CodePlex at http://sqlazuremw.codeplex.com/ .
Note that although this nifty utility migrates both 2005 and 2008 databases, it requires SQL Server 2008
R2 to run.
 
Search WWH ::




Custom Search