bcp 的一般用法

來源:互聯網
上載者:User
bcp 的一般用法 

 

用法: bcp {dbtable | query} {in | out | queryout | format} 資料檔案

  [-m 最大錯誤數]             [-f 格式檔案]         [-e 錯誤檔案]  [-F 首行]                   [-L 末行]             [-b 批大小]  [-n 本機類型]               [-c 字元類型]         [-w 寬字元類型]  [-N 將非文本保持為本機類型] [-V 檔案格式版本]     [-q 引號識別項]  [-C 字碼頁說明符]           [-t 欄位結束字元]       [-r 行終止符]  [-i 輸入檔案]               [-o 輸出檔案]         [-a 資料包大小]  [-S 伺服器名稱]             [-U 使用者名稱]           [-P 密碼]  [-T 可信串連]               [-v 版本]             [-R 允許使用地區設定]  [-k 保留空值]               [-E 保留標識值]  [-h"載入提示"]              [-x 產生xml 格式檔案]匯入csv格式檔案Exec master..xp_cmdshell 'bcp "SSIS.dbo.tb2" in "E:\export.csv" -c -t"," -r"\n" -T'匯出成csvExec master..xp_cmdshell 'bcp "SSIS.dbo.tb2" out "E:\test.csv" -c -t"," -r"\n" -T'將特定查詢匯出成預設格式預設以定位字元間隔,"\n"換行Exec master..xp_cmdshell 'bcp "select carbrand,longitude from ssis.dbo.tb2" queryout "E:\test2.txt" -c -T'其他情況參考:http://msdn.microsoft.com/zh-cn/library/ms162802.aspx啟用xp_cmdshellEXEC sp_configure 'show advanced options', 1 GO RECONFIGURE GO EXEC sp_configure 'xp_cmdshell', 1 GO RECONFIGURE GO 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.