1

再質問ではないことを願っています..しかし..

これが私のSQLの関連セクションです。問題のビュー (vw_TempALlItems) は前の手順で作成され、はい、列名を使用して作成され、タイプなどに注意を払います.ビューは 100% 動作します..しかし、BCP はそれほどではありません..

---------------------------------------------------------------
DECLARE @bcpCommand varchar(2000)

SET @bcpCommand = 'bcp vw_TempAllItems out
"c:\FEPData.csv" -c -t -U USER -P PWD'

EXEC master..xp_cmdshell @bcpCommand
GO

Drop View vw_TempAllItems
GO
----------------------------------------------------------------

私が得る唯一のことは、結果ペインにBCPコマンドパラメーターが表示されることです

    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]
    NULL

CSVファイルは作成されません..

誰?

4

2 に答える 2

1

気にするかもしれない人にとっては、うまくいく最終結果がここにあります

    DECLARE @bcpCommand varchar(2000)
    SET @bcpCommand = 'bcp ' + DB_NAME() + '..vw_TempAllItems out c:\FEPData.csv -c -t, -U User -P Pwd  -S' + @@SERVERNAME
    EXEC master..xp_cmdshell @bcpCommand
    GO
于 2013-05-08T20:04:10.807 に答える