将存储过程输出转换为表格格式 [英] Convert stored procedure output to table format

查看:207
本文介绍了将存储过程输出转换为表格格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否需要输出;不是从存储过程检索到SQL中的表的reture值吗?

所以我想基本上这样做:



Is there was to take the output; not the reture value, retrieved from a stored procedure to a table in SQL?
So I want to essentially do this:

DECLARE @TempTable Table(field1 varchar(max),field2 varchar(max), field3 varchar(max)

INSERT @TempTable= EXECUTE dbo.sp_MySP @SomeParam --Issue is this gives xml rather than a table

SELECT * FROM @TempTable

推荐答案

是的。你几乎就在那里。 =



INSERT @TempTable EXECUTE dbo.sp_MySP @SomeParam





问题是这给了xml而不是表格



哦,程序是否返回XML?
Yes. And you're almost there. Remove the =.

INSERT @TempTable EXECUTE dbo.sp_MySP @SomeParam


"Issue is this gives xml rather than a table"

Oh, does the procedure return XML?


如果您想以XML格式获得输出,请参阅:

FOR XML (SQL Server) [ ^ ]

使用PATH模式和FOR XML [ ^ ]
If you want to get output in XML format, please, see:
FOR XML (SQL Server)[^]
Use PATH Mode with FOR XML[^]


这篇关于将存储过程输出转换为表格格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆