Re: Help Retrieving XML with HTTP within stored procedure ..
From: Erland Sommarskog (esquel_at_sommarskog.se)
Date: 08/08/04
- Previous message: John Bell: "Re: Reuse Connection for Temp Tables"
- In reply to: Richard Weerts: "Help Retrieving XML with HTTP within stored procedure .."
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 8 Aug 2004 08:26:17 +0000 (UTC)
[posted and mailed, please reply in news]
Richard Weerts (rweerts@ndis.us) writes:
> Within a stored procedure, I need to retrieve XML over HTTP from an
> external URL, then load some stuff into a recordset and return as such.
>
> Like this, sort-of:
>
> -- *******************************
>
> create procudure queryremote (@param)
>
> declare @xmldoc varchar(2000)
> set @xmldoc = (GET 'http://someplaceservesXML.com/script.ext?param=' +
> @param)
>
> sp_preparedocument (@xmldoc etc.)
>
> SELECT * FROM OPENXML(thexmlthing, "/xpath")
>
> Return
If that XML document is not longer than 4000 charcters, you could write
an extended stored prodedure to fetch the document. Alternatively, you
could use a COM object and use sp_OACreate and friends to retrieve the
information.
The reason the limit would be 4000 characters, is because that is big
you can make an nvarchar value. (Need nvarchar for OPENXML). For bigger
values you need ntext, but since you cannot assign to them in a stored
procedure, you lose.
If the documents can be any size, the possibility I can think would be
to use OPENROWSET, and then implement a rowset provider that produces
the same output as OPENXML. It goes without saying that this is a major
undertaking.
You may also want to inquire in microsoft.public.sqlserver.xml for
more suggestions.
-- Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp
- Previous message: John Bell: "Re: Reuse Connection for Temp Tables"
- In reply to: Richard Weerts: "Help Retrieving XML with HTTP within stored procedure .."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|