-1
任何人都可以解释我是否可以从互联网上读取一个xml页面,并将其从mssql中拖入多个原始数据库表中?从互联网上阅读XML addrrss
IM有一个叫做页:
https://mywebsite.com/api/?u=xxxxxxx&p=yyyyyy&fields=CallerID&format=xml
这会给我下面的信息:
This XML file does not appear to have any style information associated with it. The document tree is shown below
<records>
<call>
<callingnumber>357994</callingnumber>
</call>
<call>
<callingnumber>357996</callingnumber>
</call>
<call>
<callingnumber>357995</callingnumber>
</call>
</records>
事情是这样的内容不能下载,服务器内部的XML。所以mssql必须在线阅读文件。
我试着用下面的代码,但它带有错误:
DECLARE @x XML
SELECT @x = cast(x.bulkColumn as XML)
FROM OPENROWSET(BULK 'https://mywebsite.com/api/?u=xxxxxxx&p=yyyyyy&fields=CallerID&format=xml', SINGLE_CLOB) AS x
select @x;
错误:
Cannot bulk load because the file "https://mywebsite.com/api/?u=xxxxxxx&p=yyyyyy&fields=CallerID&format=xml" could not be opened. Operating system error code 123(The filename, directory name, or volume label syntax is incorrect.).
谁能帮我解决这个问题。
问候
这是从来没有一个好主意,直接加载文件而不某种解析和错误检查。想象一下,什么样的不良数据可以进入你的系统,或者如果事情真的搞砸了,你可以有一个小鲍比表的情况。 –
@MarshallTigerus感谢您的信息,但是这些数据在xml中已经被检查过,然后才添加到该服务器。它的某种来电显示信息。当然每2天我们都会检查这些数据以防出现任何问题。你能指导我如何阅读他们吗? –
您正在将URL视为文件,这不起作用...您需要提出Web请求。在SQL中做这件事有点复杂。请查看以下示例:http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=111356 –