• I was working on a more "set-based" approach to my above comment. However, the FLWOR statements in SQL don't seem to be working correctly.

    For example, this works:

    SELECT TOP 1

    ID

    ,Data.query('

    for $n in //address/*

    where (local-name($n) = ("Line1", "Line2"))

    return $n

    ')

    FROM Addresses

    However, the "not equal" does NOT work. Instead, IT RETURNS ALL NODES!?

    SELECT TOP 1

    ID

    ,Data.query('

    for $n in //address/*

    where (local-name($n) != ("Line1", "Line2"))

    return $n

    ')

    FROM Addresses

    Basically, can anyone tell me how to make the "where" clause so that it DOES NOT return nodes with a name of "Line1" and "Line2"?