none
xml as input and output parameter in stored procedure

    Question

  • Hi,

     

    As per one of the requirement from our client we need to create a stored procedure where we need take XML as a input parameter and send a XML as a output parameter. Please provide a sample example in achieving this.

     

    Thanks,

    BI

    Wednesday, January 18, 2012 10:41 AM

Answers

  • create proc xml_test
    @xin xml='<Root><Customer><Name>Rishabh</Name></Customer></Root>',
    @xout xml output
    as
    select  @xout=@xin.query('/Root/Customer')
    GO
    declare @out xml
    exec xml_test @xout=@out output
    select @out
    GO
    drop proc xml_test

    Thanks and regards, Rishabh , Microsoft Community Contributor
    Wednesday, January 18, 2012 10:46 AM

All replies