Suspecting XML

  • We have a XML file,

    declare @xml xml,@xml_with_new_namespace

    set @xml =

    '

    '

    set @xml_with_new_namespace=

    '

    '

    below query works:

    select @xml_.value('(/root/child)[1]','varchar(50)')

    below query doesnt works:

    select @xml_with_new_namespace_.value('(/root/child)[1]','varchar(50)')

    Why?

  • set @xml =

    " '

    '"

    @xml_with_new_namespace

    " '

    '"

  • try this ....

    DECLARE @xml xml,@xml_with_new_namespace xml

    SET @xml = '

    '

    set @xml_with_new_namespace = '

    '

    select(@xml.value('(/authors/author/first-name/@FName)[3]','nvarchar(32)') )

    select(@xml_with_new_namespace.value('(/authors/author/first-name/@FName)[3]','nvarchar(32)'))

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

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