bcp匯入到mysql BCP 匯入匯出資料庫資料

2021-10-17 22:02:13 字數 1746 閱讀 2281

使用 bcp 將資料庫遷移到 azure sql database

--所有 都是在本機sql上執行

--先開啟cmdshell

exec sp_configure 'show advanced options', 1

goreconfigure

goexec sp_configure 'xp_cmdshell', 1

goreconfigure

go/**匯出指定表的文字檔案 */

--exec master..xp_cmdshell 'bcp mydb.dbo.feedbacks out d:\bcpfile\exportfeedbacks.dat -c -s (local) -u sa -p sa'

-- 新增 檔案格式  匯出資料檔案

----e

如果未指定 -e,則將忽略所匯入資料檔案中此列的標識值,而且 sql server 將根據建立表期間指定的種子值和增量值自動分配唯一值。

如果資料檔案不包含表或檢視中的標識列的值,則可使用格式化檔案指定,在匯入資料時應跳過錶或檢視中的標識列;sql server 將自動為該列分配唯一值。 有關詳細資訊,請參閱 dbcc checkident (transact-sql)。

-e 選項有乙個特殊的許可權要求。 有關詳細資訊,請參閱本主題後面的「備註」。

-c 指定該資料檔案中資料的**頁

**頁 值 raw

不進行**頁間的轉換。 因為不進行轉換,所以這是最快的選項。-n使用資料的本機(資料庫)資料型別執行大容量複製操作。 此選項不提示輸入每個字段,它將使用本機值。

--feedbacks表 匯出

exec master..xp_cmdshell 'bcp mydb.dbo.feedbacks out d:\bcpfile\exportfeedbacks.dat -s (local) -u sa -p sa -e -n -c raw '

--feedbacks表 匯出

-- 新增 檔案格式  匯入資料檔案 到 伺服器是 rty5678i.database.windows.net(雲平台資料庫)的 ymydb資料庫裡  有相同的表結構

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表 匯出

exec master..xp_cmdshell 'bcp mydb.dbo.mobiles out d:\bcpfile\exportmobiles.dat -s (local) -u sa -p sa -e -n -c raw '

--mobiles表 匯入

exec master..xp_cmdshell 'bcp ymydb.dbo.mobiles in d:\bcpfile\exportmobiles.dat  -s rty5678i.database.windows.net -u [email protected] -p 8uhb&ujmkloi -e -n -c raw '

測試通過 千萬級別的資料匯出匯入

可以使用工具 把本地資料庫匯入到sql azure中呢?

使用 sqlazuremw

george 建立了 sqlazuremw 來幫助我們的客戶完成 sql 資料庫遷移過程

bcp命令匯入大量資料到sql server

公司進行年終總結,需要對300w客戶進行追蹤,但是這300w客戶的id匯入資料庫中讓我小小糾結了一下。因為需求部門提給我的是excel的資料格式,所以第一反應是用excel匯入,但是sql server2005只支援office 2003的格式,所以只能用xls匯入,但是xls一張表只能支援6553...

Excel資料匯入到Grid

方法一 string strcon provider microsoft.jet.oledb.4.0 data source strsource extended properties excel 8.0 string query select from sheet1 sheet1表示表 oledb...

Excel資料匯入到Access

下面是asp的全部程式,需要做的是建乙個test.mdb資料庫和乙個test.xls的excel 查詢excel準備匯入到access sql select from sheet1 要匯入的excel資料裡面的表的名稱,後面一定要加 set rs conn2.execute sql while no...