怎么获得接口数据(XML格式的),然后导入SQL,最好有个简单的例子 30
从对方的程序上获取的,就是通过https接口..例如:GEThttps:)order/contents?name=complete...
从对方的程序上获取的,就是通过https接口..
例如:GET https:)order/contents?name=complete 展开
例如:GET https:)order/contents?name=complete 展开
1个回答
展开全部
/* OpenXML function */
declare @xmldoc varchar(2000); /* 这个变量的值就是你得到的xml串 */
declare @idoc int;
set @xmldoc ='
<Site URL="http://www.contoso.com/index.htm">
<Site URL="http://www.contoso.com/finance/index.htm">
<Site URL="http://www.contoso.com/finance/reports/index.htm" />
<Site URL="http://www.contoso.com/finance/main/index.htm" />
</Site>
<Site URL="http://www.contoso.com/marketing/index.htm">
<Site URL="http://www.contoso.com/marketing/reports/index.htm" />
<Site URL="http://www.contoso.com/marketing/main/index.htm" />
</Site>
<Site URL="http://www.contoso.com/sales/index.htm" />
</Site>';
exec sp_xml_preparedocument @idoc output, @xmldoc;
select ParentSiteURL, SiteURL
from openxml(@idoc,'//Site',1)
with (
ParentSiteURL nvarchar(512) '../@URL'
,SiteURL nvarchar(521) '@URL'
);
declare @xmldoc varchar(2000); /* 这个变量的值就是你得到的xml串 */
declare @idoc int;
set @xmldoc ='
<Site URL="http://www.contoso.com/index.htm">
<Site URL="http://www.contoso.com/finance/index.htm">
<Site URL="http://www.contoso.com/finance/reports/index.htm" />
<Site URL="http://www.contoso.com/finance/main/index.htm" />
</Site>
<Site URL="http://www.contoso.com/marketing/index.htm">
<Site URL="http://www.contoso.com/marketing/reports/index.htm" />
<Site URL="http://www.contoso.com/marketing/main/index.htm" />
</Site>
<Site URL="http://www.contoso.com/sales/index.htm" />
</Site>';
exec sp_xml_preparedocument @idoc output, @xmldoc;
select ParentSiteURL, SiteURL
from openxml(@idoc,'//Site',1)
with (
ParentSiteURL nvarchar(512) '../@URL'
,SiteURL nvarchar(521) '@URL'
);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询