作者:风过无痕啦啦 | 来源:互联网 | 2023-01-17 14:02
IamtryingtostoreanXMLfile(Codebelow)butthethedc:creatoriscausinganerror.Ihavefou
I am trying to store an XML file (Code below) but the the dc:creator is causing an error. I have found from other related questions on here stating that I should use ;WITH XMLNAMESPACES(''http://purl.org/dc/elements/1.1/'' AS dc) but this has not worked either any ideas on what might be the problem/solution ? .
我正在尝试存储XML文件(下面的代码),但dc:creator导致错误。我在这里找到了其他相关问题,说明我应该使用;使用XMLNAMESPACES(''http://purl.org/dc/elements/1.1/''AS dc),但这对于什么可能没有任何想法是问题/解决方案? 。
XML file:
XML文件:
-
-
http://talksport.com/rss/sports-news/football/feed
en
--
http://talksport.com/football/hillsborough-families-back-introduction-rail-seating-bereaved-family-says-standing-did-not
Wed, 19 Jul 2017 08:18:37 +0000
talkSPORT
247276 at http://talksport.com
This is the stored procedure:
这是存储过程:
CREATE PROCEDURE feed.usp_importXML(@file VARCHAR(8000))
AS
BEGIN
DECLARE @Query VARCHAR(8000)
SET @Query ='
DECLARE @xmlFile as XML
SET @xmlFile = ( cast
SELECT CONVERT(XML,BulkColumn) as BulkColumn
FROM OPENROWSET (BULK '''+@file+''', SINGLE_BLOB) AS t)
INSERT INTO feed.tempXML (title,link,source)
SELECT
title = t.value (''title[1]'', ''NVARCHAR(300)''),
link = t.value (''link[1]'', ''NVARCHAR(300)''),
source = t.value(''(dc:creator)[1]'',''NVARCHAR(30)'')
FROM @xmlFile.nodes(''/rss/channel/item'') AS xTable(t);'
EXEC(@Query)
END
GO
1 个解决方案