reading xml

  • If some one can help me out to correct my syntax would be great as i am reading an xml with value method

    below is hte query

    DECLARE @UserLFAMap_Rejected XML

    SET @UserLFAMap_Rejected = ' '

    --SELECT Modules.module.ID.value('.','VARCHAR(50)')as Module123

    Select Module.ID.value('.','VARCHAR(20)')AS Module123 ,

    Feature.ID.value('(../../Feature)[1]','VARCHAR(50)'),

    Access.ID.value('(../../Access)[1]','VARCHAR(50)')

    FROM @UserLFAMap_Rejected.nodes('/Modules/Module/ID') as Modules(ID)

  • SELECTModules.ID.value('.', 'VARCHAR(20)') AS Module123 ,

    Modules.ID.value('(../../Feature)[1]', 'VARCHAR(50)') AS Feature123,

    Modules.ID.value('(../../Access)[1]', 'VARCHAR(50)') AS Access123

    FROM@UserLFAMap_Rejected.nodes('/Modules/Module/ID') as Modules(ID)


    N 56°04'39.16"
    E 12°55'05.25"

  • The above thing dosent work as it has 2 values for each node and i need to read all the 2 values

    any luck from any 1

  • New requirements?

    SELECTModules.ID.value('.', 'VARCHAR(20)') AS Module123,

    Modules.ID.value('(../../Feature)[1]', 'VARCHAR(50)') AS Feature123a,

    Modules.ID.value('(../../Feature)[2]', 'VARCHAR(50)') AS Feature123b,

    Modules.ID.value('(../../Access)[1]', 'VARCHAR(50)') AS Access123a,

    Modules.ID.value('(../../Access)[2]', 'VARCHAR(50)') AS Access123b

    FROM@UserLFAMap_Rejected.nodes('/Modules/Module/ID') as Modules(ID)


    N 56°04'39.16"
    E 12°55'05.25"

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

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