BCP Import Export Database data

Source: Internet
Author: User

Use bcp to migrate databases to Azure SQL database

--All running on native SQL
--Open Cmdshell first
EXEC sp_configure ' show advanced options ', 1
GO
RECONFIGURE
GO
EXEC sp_configure ' xp_cmdshell ', 1
GO
RECONFIGURE
GO
/** Export the text file for the specified table */
--exec Master. xp_cmdshell ' bcp MyDB.dbo.Feedbacks out D:\BcpFile\exportFeedbacks.dat-c-S (local)-U sa-p sa '
--Add File format export data file

----e

If- eis not specified, the identity value of this column in the imported data file is ignored, and SQL Server automatically assigns unique values based on the seed and increment values specified during the creation of the table.

If the data file does not contain the value of an identity column in a table or view, you can use a format file to specify that the identity column in the table or view should be skipped when the data is imported, and SQL Server will automatically assign a unique value to the column. For more information, see DBCC checkident (Transact-SQL).

The- e option has a special permission requirement. For more information, see "Remarks" later in this topic.

- C { ACP | OEM | RAW | Code_page}

Specify the code page for the data in the data file

code page Value RAW

No conversion between code pages is performed. This is the quickest option because there is no conversion. - N performs a bulk copy operation using the native (database) data type of the data. This option does not prompt for each field, it uses a native value.

--feedbacks Table Export
EXEC Master. xp_cmdshell ' bcp myDB.dbo.Feedbacks out D:\BcpFile\exportFeedbacks.dat-S (local)-u sa-p sa-e-n-c RAW '

--feedbacks Table Export
--Add File format import data file to server is rty5678i.database.windows.net (Cloud Platform database) The YMYDB database has the same table structure
EXEC Master. xp_cmdshell ' BCP YMyDB.dbo.Feedbacks in D:\BcpFile\exportFeedbacks.dat-S rty5678i.database.windows.net-u [email Protected] -p 8uhb&ujmkloi-e-n-c RAW '

--mobiles Table Export
EXEC Master. xp_cmdshell ' bcp myDB.dbo.Mobiles out D:\BcpFile\exportMobiles.dat-S (local)-u sa-p sa-e-n-c RAW '
--mobiles Table Import
EXEC Master. xp_cmdshell ' BCP YMyDB.dbo.Mobiles in D:\BcpFile\exportMobiles.dat-S rty5678i.database.windows.net-u Mydbadmin@rty5678i.database.windows.net-p 8uhb&ujmkloi-e-n-c RAW '

The test is exported by tens other data import

Can you use tools to import a local database into SQL Azure?

Using SQLAZUREMW

Address http://sqlazuremw.codeplex.com/

George created SQLAZUREMW to help our customers complete the SQL database migration process

BCP Import Export Database data

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.