Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2011
    Posts
    47

    Unanswered: can you solve my problem ?

    hi , i have created an sp which accepts an argument as xml and does the insertion , my problem is when i pass the xml doc to my sp it throws an exception
    Code:
    XML parsing: line 1, character 29, A string literal was expected
    my sp code is
    Code:
    USE [hmsnew]
    GO
    /****** Object:  StoredProcedure [dbo].[usp_InsertUpdateUserPermissions]    Script Date: 06/05/2012 15:57:37 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    
    ALTER PROCEDURE [dbo].[usp_InsertUpdateUserPermissions]
    @xmlData xml
    AS
    declare @xmlHandle int
    exec sp_xml_preparedocument @xmlHandle OUTPUT, @xmlData
    insert into User_Permission 
    (
    	Login_ID,
    	Mod_Page_Assoc_ID,
    	CanAdd,
    	CanUpdate,
    	CanDelete,
    	CanView,
    	CreatedBy,
    	CreateDatetime,
    	UpdatedBy,
    	UpdateDatetime,
    	Reason
    )
    select 
    Login_ID,
    Mod_Page_Assoc_ID,
    CanAdd,
    CanUpdate,
    CanDelete,
    CanView,
    CreatedBy,
    CreateDatetime,
    UpdatedBy,
    UpdateDatetime,
    Reason
    from openxml(@xmlHandle, 'root/association',1)
    with
    (
    	Login_ID int, 
    	Mod_Page_Assoc_ID int ,
    	CanAdd bit ,
    	CanUpdate bit ,
    	CanDelete bit ,
    	CanView bit ,
    	CreatedBy int ,
    	CreateDatetime datetime ,
    	UpdatedBy int ,
    	UpdateDatetime datetime,
    	Reason varchar(100) )
    can any help please...?

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Sure..post your xml
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •