我從視圖中選擇數據數據導出到Excel中使用BCP和commandShell
我正在錯誤
usage: bcp [[db_name.]owner.]table_name[:slice_num] [partition pname] {in | out} [filename]
[-m maxerrors] [-f formatfile] [-e errfile] [-d discardfileprefix]
[-F firstrow] [-L lastrow] [-b batchsize]
[-n] [-c] [-t field_terminator] [-r row_terminator]
[-U username] [-P password] [-I interfaces_file] [-S server]
[-a display_charset] [-z language] [-v]
[-i input_file] [-o output_file]
[-A packet size] [-J client character set]
[-T text or image size] [-E] [-g id_start_value] [-N] [-W] [-X]
[-M LabelName LabelValue] [-labeled]
[-K keytab_file] [-R remote_server_principal] [-C]
[-V [security_options]] [-Z security_mechanism] [-Q] [-Y]
[-y sybase directory] [-x trusted.txt_file]
[--clienterr errfile] [--maxconn maximum_connections]
[--show-fi] [--hide-vcc]
[--colpasswd [[[db_name.[owner].]table_name.]column_name [password]]]
[--keypasswd [[db_name.[owner].]key_name [password]]]
[--initstring ASE initialization string] [--quoted-fname]
NULL
declare @sql varchar(8000)
Select @sql= 'bcp "Select * from eBenefitSync_GUI_PH.dbo.Disp_View" out D:\Contacts.txt -c -T ' +'-s ' [email protected]@servername+'\'[email protected]@servicename
--EXECUTE master.dbo.xp_cmdshell @SQL
請打印'@ sql'併發布 –
您是否嘗試過使用''-s'+ @@ SERVERNAME'? –
是的,它沒有使用它,但使用IP,不知道爲什麼(超時錯誤),我也使用了servername \ instancename以及 – Ashu