BCP用法

/* BCP用法: bcp {dbtable | query} {in | out | queryout | format} 數據文件 dbtable | query :表或結果集 in : 導入數據 out : 導出數據 queryout : 有條件導出數據 [-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 格式化文件] */ --帶條件查詢導出, EXEC master..xp_cmdshell 'bcp "select * from TEST..Demo_A" queryout D:\Test\1.xls -c -q -T' EXEC master..xp_cmdshell 'bcp "select * from TEST..Demo_A" queryout D:\Test\1.xls -c -q -S"." -U"sa" -P"123123"' --所有表數據導出 EXEC master..xp_cmdshell 'bcp TEST.dbo.Demo_A out D:\Test\1.xls -c -q -T' --導入數據,表結構一致 EXEC master..xp_cmdshell 'bcp TEST..Demo_A in D:\Test\1.xls -T -c' --解決一些報錯處理 -- To allow advanced options to be changed. EXEC sp_configure 'show advanced options', 1 GO -- To update the currently configured value for advanced options. RECONFIGURE GO -- To enable the feature. EXEC sp_configure 'xp_cmdshell', 1 GO -- To update the currently configured value for this feature. RECONFIGURE GO
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章