none
Creating XML file from stored procedure using bcp RRS feed

  • Question

  • Hello,

    I'm trying to run this:

    Code Snippet

    DECLARE @FileName varchar(50), @bcpCommand varchar(2000) SET @FileName = REPLACE('c:\TreeView_'+CONVERT(char(8),GETDATE(),1)+'.xml','/','-') SET @bcpcommand = 'bcp "nightwatchman..GetTreeViewXML" queryout "c:\text.xml" -c -T -x' SET @bcpCommand = @bcpCommand + @FileName + '" -U nightadmin -P n1ghtadm1n' EXEC nightwatchman..xp_cmdshell @bcpCommand


    But I get the following error:

    Code Snippet

    bcp: unknown option : 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] NULL


    Any help is greatly appreciated.
    Wednesday, November 26, 2008 1:40 PM