Is there any support in SQL Server for loading / reading / moving / importing / selecting / pasting XML directly from a web server into a table?
Pretend that I want to get XML from a web server, for example:
SQL Server 2005 (and newer) has built-in support for XML data types. In the past few months, the internet has become really popular. The ability to find information on the Internet can be useful and important.
Does SQL Server support such a thing?
Or I need to use (pseudo-code):
XmlHttpRequest xml = new XmlHttpRequest("http://treasury.gov/ExchangeRates.xml");
SqlServerConnection conn = new SqlServerConnection("neptune", "sa", "password");
conn.Execute("INSERT INTO Exchange Rates (RatesXml) VALUES (%1)", xml.ResponseStream);
Change one . Since Windows can create open files via http:
http:
transparent as opening files from a local hard drive:
c:\Windows\Temp\HardDrivePrices.xml
, SQL Server XML . filename filenameUrl, :
CREATE TABLE docs (pk INT PRIMARY KEY, xCol XML not null)
INSERT INTO docs
SELECT 10, xCol
FROM (SELECT * FROM OPENROWSET
(BULK 'http://www.bankofcanada.ca/stat/fx-xml.xml',
SINGLE_BLOB) AS xCol) AS R(xCol)
:
, http://www.bankofcanada.ca/stat/fx-xml.xml" . 123 ( , .).