Update-records by passing XML values

  • Hi all,

    I have created a procedure to update table records by passing Xml values but im getting error and i don know where im making mistakes,can any one help me this..

    The following is the coding ..

    create procedure upd_screen_optional_data

    (

    @xmldoc ntext

    )

    as

    begin

    declare @v_error_no int

    declare @xml_hnd INT

    EXEC sp_xml_preparedocument @xml_hnd OUTPUT, @XMLDOC

    update screen_optional_data

    set

    screen_optional_data.value=xmltable.value

    from openxml(@xmldoc,'/Newdataset/table', 2)

    with

    option_id xmloption_id,

    value xmlvalue

    where screen_optional_data.optionid=xmltable.optionid

    EXECUTE sp_xml_removedocument @xml_hnd

    if @@error <> 0 or @@rowcount = 0

    begin

    set @v_error_no = 9999

    select @v_error_no as db_error

    return

    end

    set @v_error_no = 0

    select @v_error_no as db_error

    return

    end

    Thanks in Advance.

  • You should use handleyou got from sp_xml_preparedocument in OPENXML, not the parameter you pass to proc.

    Regards

    Piotr

    ...and your only reply is slàinte mhath

  • Ya you are correct i have modified that now it's working fine

    Thaks for your response

    Thanks

    Chandru

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply