Quantcast
Channel: SQL Server Training | Tutorials | How to's » SQL Server 2008 Transferring Data
Viewing all articles
Browse latest Browse all 2

Transferring Data – contd…

$
0
0

Previous Post

The Database Copy Wizard

The Copy Database Wizard lets you move or copy databases and their objects easily from one server to another, with no server downtime. Using this wizard, you can do the following:

  • Pick a source and destination server.
  • Select databases to move or copy.
  • Specify the file location for the databases.
  • Create logins on the destination server.
  • Copy additional supporting objects, jobs, user-defined stored procedures, and error messages.
  • Schedule when to move or copy the databases.

Note that the Copy Database wizard cannot be used on the system databases msdb, master, and model.

Area Consideration
Required permissions You must be a member of the sysadmin fixed server role on both the source and destination servers.
Required components SQL Server 2005 Integration Services (SSIS) or later.
model, msdb and master databases The model, msdb, and master databases cannot be copied or moved by the Copy Database Wizard.
Database on source server If you select the Move option, the wizard deletes the source database automatically after moving the database. The Copy Database Wizard does not delete a source database if you select the Copy option.
Full-text catalogs If you use the SQL Server Management Object method to move the full-text catalog, you must repopulate the index after the move. If you use the detach-and-attach method, full-text catalogs must be moved manually. For more information about how to move full-text catalogs, see Moving Database Files.

Considerations for Bulk Import/Export

BCK

BULKINSER

OPENROWSET(BULK)

These three tools can be used in similar situations.  Become familiar with their use and be better able to select the right application for a given task.

bcp

The bcp utility bulk copies data between an instance of Microsoft SQL Server 2008 and a data file in a user-specified format. The bcp utility can be used to import large numbers of new rows into SQL Server tables or to export data out of tables into data files. Except when used with the queryout option, the utility requires no knowledge of Transact-SQL. To import data into a table, you must either use a format file created for that table or understand the structure of the table and the types of data that are valid for its columns.

BULK INSERT

BULK INSERT loads data from a data file into a table. This functionality is similar to that provided by the in option of the bcp command; however, the data file is read by the SQL Server process. The BULK INSERT statement and OPENROWSET(BULK) function execute in-process with SQL Server, sharing the same memory address space. Because the data files are opened by a SQL Server process, data is not copied between client process and SQL Server processes.

OPENROWSET(BULK)

OPENROWSET can be used to access remote data from OLE DB data sources only when the DisallowAdhocAccess registry option is explicitly set to 0 for the specified provider, and the Ad Hoc Distributed Queries advanced configuration option is enabled. When these options are not set, the default behavior does not allow for ad hoc access.

XML Bulk Load

The xml data type lets you store XML documents and fragments in a SQL Server database. An XML fragment is an XML instance that is missing a single top-level element. You can create columns and variables of the xml type and store XML instances in them.

Bulk Load can be used with XML to produce or consume XML documents from SQL data.

You can optionally associate an XML schema collection with a column, a parameter, or a variable of the xml data type. The schemas in the collection are used to validate and type the XML instances. In this case, the XML is said to be typed.

The xml data type and associated methods help integrate XML into the relational framework of SQL Server.

Bulk importing XML data as a binary byte stream

When you bulk import XML data from a file that contains an encoding declaration that you want to apply, specify the SINGLE_BLOB option in the OPENROWSET(BULK…) clause. The SINGLE_BLOB option makes sure that the XML parser in SQL Server imports the data according to the encoding scheme specified in the XML declaration.

Bulk importing XML data in an existing row

Use the OPENROWSET bulk rowset provider to add an XML instance to an existing row or rows.

Use Document Type Definitions (DTD)

If DTD is enabled, use it to define the import behavior of XML. Import XML data from a data file that contains a DTD by using the OPENROWSET(BULK…) function and then specifying the CONVERT option in the SELECT clause of the command.

The post Transferring Data – contd… appeared first on SQL Server Training | Tutorials | How to's.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images