error on xml paramter in stored procedure

  • Hi. I have a stored procedure. It is written before two years. Now i need to run this. But i have a problem. Below, i show how i run stored procedure and values. These values comes from program.

    GO

    DECLARE@return_value int

    EXEC@return_value = [dbo].[PRC_KLS_Rapor_DavranisNotlariListesi]

    @SiniflarXML = N'<?xml version=\"1.0\" encoding=\"utf-16\"?><IDLIST><ID VALUE=\"d4c810ba-36ea-4872-84d0-8c4cfe956e3c\" /><ID VALUE=\"62d6159f-809f-4b5e-9071-8058f47e57fc\" /></IDLIST>',

    @DonemID = 1,

    @DersYiliID = 'f7a801a6-f66f-4ae6-838a-33bdfb0fd52b'

    SELECT'Return Value' = @return_value

    GO

    In stored procedure xml file processed as below:

    DECLARE @hDoc int

    EXEC sp_xml_preparedocument @hDoc OUTPUT, @SiniflarXML;

    SELECT VALUE INTO #tmpSiniflar FROM OpenXML(@hDoc, '/IDLIST/ID', 1) WITH (VALUE uniqueidentifier)

    EXEC sp_xml_removedocument @hDoc

    SELECT * FROM Siniflar

    ...

    ..

    where S.DersYiliID = @DersYiliID

    AND S.SinifID IN (SELECT VALUE FROM #tmpSiniflar)

    AND ODN.DonemID = @DonemID

    When i run SP, it gives below error.

    Msg 9413, Level 16, State 1, Procedure PRC_KLS_Rapor_DavranisNotlariListesi, Line 0

    XML parsing: line 1, character 15, A string literal was expected

    I don't know weel xml on sql server. Can oneon help me about this? Thanks in advance.

  • no need to escape double quote, try passing this:

    N'<?xml version="1.0" encoding="utf-16"?><IDLIST><ID VALUE="d4c810ba-36ea-4872-84d0-8c4cfe956e3c" /><ID VALUE="62d6159f-809f-4b5e-9071-8058f47e57fc" /></IDLIST>'

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

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

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