.nodes.value showing as invalid object in sq; server 2008 r2

  • Hi, I have a requirement to convert columns to rows in a dimension table load process.
    I have put together the following from stackoverflow
    https://stackoverflow.com/questions/18026236/sql-server-columns-to-rows

    ;with CTE1 as (
    select
    t.booking,

    t.branch_code,

    t.company,

    t.trans_number,

    t.trip,

    (select t.* for xml raw('row'), type) as Data

    from My_Table as t
    ), CTE2 as (

    select

    C.booking, C.branch_code,c.trip,c.company,c.trans_number,

    F.C.value('local-name(.)', 'nvarchar(128)') as IndicatorName,

    F.C.value('.', 'nvarchar(max)') as IndicatorValue

    from CTE1 as c

    outer apply c.Data.nodes('row/@*') as F(C)

    )


    select * from CTE2

    The bottom line shows c.data.nodes as an invalid object.
    I am wondering if I have a syntax error or is it that 2008 R2 can't handle it?

    Any ideas gratefully received.

    Dave

  • ignore me - I forgot it always fails the syntax checker in 2008 r2 - only been using xml.nodes for about 5 years so still a beginner really!!

    Dave

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

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