none
specifics of BCP output xml file RRS feed

  • Question

  • I am outputing the results of a query to XML using BCP and my customer is going to be polling for this file.

    declare @sql varchar(8000)
    
    select @sql = 'bcp "SELECT * FROM SomeDB.dbo.Table WHERE RowID=' + @rowID + 'FOR XML AUTO, TYPE " queryout \\FileServer\Public\output\'xml -T -c -t' + @rowID + '_SqlOutput.
    
    
    
    exec master..xp_cmdshell @sql
    
    

    So I am wondering if anyone knows how the file is written?  What I mean, can the file show up in Windows, but it is not yet fully written, or does it only showup when the file write process is completed?

    Thanks!

    • Edited by daktmacfan Monday, December 20, 2010 4:24 PM fixed typo
    Monday, December 20, 2010 4:21 PM

Answers

  • Hi daktmacfan,

     

    Please try the command below:

    declare @sql varchar(8000)

    select @sql = 'bcp "SELECT * FROM SomeDB.dbo.Table WHERE RowID=' + @rowID + ' FOR XML AUTO, TYPE " queryout \\FileServer\Public\output\xml -T -c -t \t'

    exec master..xp_cmdshell @sql

     

    Meanwhile it seems some part of this script is missing, before further investigation, please provide us the full script and more information about what you want to do.

     

    If anything is unclear, please let me know.


    Regards,
    Tom Li
    Wednesday, December 22, 2010 7:18 AM
    Moderator

All replies

  • Nobody has any thoughts here?
    Tuesday, December 21, 2010 2:35 PM
  • Hi daktmacfan,

     

    Please try the command below:

    declare @sql varchar(8000)

    select @sql = 'bcp "SELECT * FROM SomeDB.dbo.Table WHERE RowID=' + @rowID + ' FOR XML AUTO, TYPE " queryout \\FileServer\Public\output\xml -T -c -t \t'

    exec master..xp_cmdshell @sql

     

    Meanwhile it seems some part of this script is missing, before further investigation, please provide us the full script and more information about what you want to do.

     

    If anything is unclear, please let me know.


    Regards,
    Tom Li
    Wednesday, December 22, 2010 7:18 AM
    Moderator