Bulk add in more than 1 column

  • Insert Into absorbentorder(ChalanNo,dpc)

    SELECT 'chalanno',items.item.value('.','varchar(150)') As dpc

    FROM @items.nodes('/absorbentitems/item/dpc') items(item)

    BULK add is ok giving no error

    But WIth Below

    Insert Into absorbentorder(ChalanNo,dpc,epc)

    SELECT 'chalanno',items.item.value('.','varchar(150)') As dpc,items.item.value('.','varchar(150)') As epc

    FROM @items.nodes('/absorbentitems/item/dpc') items(item)

    Gives Error

    Please Help

    My xml is this which is differrent than the order example so i am getting error

    501

    e01

    502

    e02

  • We don't know what your XML looks like or the table. We don't know the data, and you didn't give the error.

    Please provide more details.

    Moved to XML forum

  • Hi

    Your XML works fine for me:

    DECLARE @t TABLE

    (

    ChanalNo VARCHAR(20),

    dpc VARCHAR(150),

    epc VARCHAR(150)

    )

    DECLARE @items xml

    SELECT @items = '

    501

    e01

    502

    e02

    '

    INSERT INTO @t

    SELECT

    'chalanno',

    items.item.value('.','varchar(150)') As dpc,

    items.item.value('.','varchar(150)') As epc

    FROM @items.nodes('/absorbentitems/item/dpc') items(item)

    There seems to be another problem. Could you specify your exact error message, please?

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

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