[英]Can't makes BCP to export data from view to csv
感謝domenicr現在,我知道bcp鍵區分大小寫。 但是出現另一個問題-每次我運行腳本時bcp詢問我要寫入文件的字段類型-是否可以自動執行?
Enter the file storage type of field Employee_ID [char]:
我需要將數據從視圖導出到csv文件。 在我看來,最簡單的方法是BCP。 我試圖閱讀MSDN https://msdn.microsoft.com/zh-cn/library/ms162802.aspx以獲取語法幫助,但是我無法使bcp創建文件錯誤原因(從cmd運行bcp)。 在此先感謝您對語法的任何幫助。
bcp [base_name].[dbo].[all_users_for_ad] out 1.csv -t -c -u mylogin -p mypassword -s mysever
bcp: unknown option u
usage: bcp {dbtable | query} {in | out | queryout | format} datafile
[-m maxerrors] [-f formatfile] [-e errfile]
[-F firstrow] [-L lastrow] [-b batchsize]
[-n native type] [-c character type] [-w wide character type]
[-N keep non-text native] [-V file format version] [-q quoted identifier]
[-C code page specifier] [-t field terminator] [-r row terminator]
[-i inputfile] [-o outfile] [-a packetsize]
[-S server name] [-U username] [-P password]
[-T trusted connection] [-v version] [-R regional enable]
[-k keep null values] [-E keep identity values]
[-h "load hints"] [-x generate xml format file]
BCP命令參數區分大小寫。 應該是-T和-S。 對於可信連接,無需傳遞用戶名和密碼。
使用-c指定字符數據類型或使用-f參數提供格式文件
有關如何創建格式文件的信息,請參考此內容。 https://msdn.microsoft.com/zh-CN/library/ms191516.aspx
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.