开发者

how to get an xml in a variable

I have a stored procedure that will return xml. I have delared a variable of type xml and trying to execute the following code

 declare @v xml
 set @v = execute get_xml @id, 33

whereas id is returned by another query. now it keep开发者_Python百科s compalinng about the following error Incorrect syntax near the keyword 'execute'.


Instead of returning it make the XML an OUTPUT parameter and call like

declare @v xml
execute get_xml @id, 33, @v OUTPUT 

The definition of the sp will need to be changed as well. example below.

CREATE PROCEDURE get_xml2 
@id INT, 
@OtherNumber INT, 
@XML XML = NULL OUTPUT
AS


SET @XML = '<blah />'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜