How to open XML file from a website using xp_cmdshell

  • Hi All,

    How do I open an XML file from a website using xp_cmdshell?

    Thanks.

  • Please don't post multiple times. Also, adding URGENT doesn't accomplish anything. This is a free forum whose participants volunteer to help each other out. It is not a crisis hotline.

    Stored procedures in SQL can accept XML as a datatype for parameters, but something else has to call the procedure and pass the XML to it. I am aware of no functionality in T-SQL that can directly access a website and read data from it.

    If the XML has already been downloaded and stored in a directory accessible by the server, SQL can access the table using the OPENROWSET function. Try a search on that in Books Online.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Thank you for your time and response. I understand that xp_commandshell can either open the file for the website or run a script that has a code to open the file from a website. I need the syntax.

    Thanks again.

  • All xp_cmdshell does is launch code outside of SQL.

    From Books Online:

    xp_cmdshell (Transact-SQL)

    Spawns a Windows command shell and passes in a string for execution. Any output is returned as rows of text.

    Syntax

    xp_cmdshell { 'command_string' }

    Example

    EXEC xp_cmdshell 'dir *.exe';

    GO

    If you are asking for a script to download from a database and output XML, that is not a T-SQL question.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Thanks again for your response. I am not asking for a script, but I want to run a script in sql. The script can be created in java to open the file from a website. After i have created the script, the question is how do i run it within sql.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply