-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 –