我想導出從sql查詢生成的xml。我想這樣的XML保存/導出 - SQL Server - 複製方向必須爲'in','out'或'format'
EXEC master.dbo.sp_configure 'show advanced options', 1
RECONFIGURE
EXEC master.dbo.sp_configure 'xp_cmdshell', 1
RECONFIGURE
EXEC xp_cmdshell 'bcp "SELECT @xml" -S <SERVERNAME> -D <DATABASE_NAME> -U <UserName> -P <PASSWORD> queryout "E:\test.xml" -T -c -t,'
試圖這樣我得到了下面
Copy direction must be either 'in', 'out' or 'format'.
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]
[-d database name] [-K application intent]
列出的結果我沒能找出問題。
我的問題是 -
我做錯了嗎?
如何在驅動器中保存/導出xml文件?