本文介绍了将XML数据插入声明的SQL表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,
有人可以向我解释如何执行一个存储过程,该过程产生XML输出,然后获取该XML输出并将其插入我声明的表中吗?
例如
DECLARE @ cache TABLE (
val1 varchar (max)
val2 varchar (max)
val3 varchar (max)
)
INSERT @ cache EXECUTE usp_Yoursp @ Id = 123
SELECT * FROM @cache
SPusp_Yoursp会产生一些我试图插入@cache的XML,但由于列名或数量而失败提供的值不合理ch表定义。这是因为我试图直接将一些XML插入表中。我怎样才能正确地执行此操作?
解决方案
Hello,
Can someone explain to me how to execute a stored procedure that yields output that is XML and then take that XML output and insert it into the table I've declared?
e.g.
DECLARE @cache TABLE ( val1 varchar(max) val2 varchar(max) val3 varchar(max) ) INSERT @cache EXECUTE usp_Yoursp @Id=123 SELECT * FROM @cache
The SP "usp_Yoursp" yields some XML that I am trying to insert into @cache, but it fails because "Column name or number of supplied values does not match table definition". This is because I am trying to directly insert some XML into a table. How can I properly go about doing this?
解决方案
这篇关于将XML数据插入声明的SQL表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!