CROSS APPLY on named sets

  • Comments posted to this topic are about the item CROSS APPLY on named sets

    ----------------------------------------------------

  • I dunno about the "correct" answer on this one. The statements compile for me but produce an error at run-time. Seems to be a bit of a mixup here.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • SQLRNNR (1/12/2016)


    I dunno about the "correct" answer on this one. The statements compile for me but produce an error at run-time. Seems to be a bit of a mixup here.

    What version of SQL Server? It fails the compilation on 2008,2008R2,2012 and 2014.

    😎

  • This was removed by the editor as SPAM

  • Phew.., I got the two points for the answer - but can't say I got the point of the question, even reading the outline. - Lucky though, to keep my streak alive: Tomorrow it is either one full month since mid-december, or devastation.

  • The T-SQL parses OK but does not compile. A lesson re-learnt this morning for me; the difference between parse and compile. 🙂

  • I think it's the difference between "parse" and "compile" that is causing the confusion here.

  • I disagree with explanation, the error generated

    Msg 4104, Level 16, State 1, Line 2

    The multi-part identifier "o.object_id" could not be bound.

    it's not caused by CROSS APPLY, but a reference to a column not yet linked.

    These examples generate the same error:

    SELECT s1.c1, o.object_id

    FROM (values (o.object_id+2)) s1(c1)

    CROSS JOIN sys.objects o

    or

    SELECT s1.c1, o.object_id

    FROM (values (o.object_id+2)) s1(c1)

    JOIN sys.objects o on 1=1

  • This is what I got 🙂

    c1 c1

    77

    78

    79

  • Eirikur Eiriksson (1/12/2016)


    SQLRNNR (1/12/2016)


    I dunno about the "correct" answer on this one. The statements compile for me but produce an error at run-time. Seems to be a bit of a mixup here.

    What version of SQL Server? It fails the compilation on 2008,2008R2,2012 and 2014.

    😎

    I can't find any option to compile a query. Parse, yes (the query parses). Execute, yes (the query fails - "The multi-part identifier "s2.c1" could not be bound.") But compile?

  • edwardwill (1/13/2016)


    Eirikur Eiriksson (1/12/2016)


    SQLRNNR (1/12/2016)


    I dunno about the "correct" answer on this one. The statements compile for me but produce an error at run-time. Seems to be a bit of a mixup here.

    What version of SQL Server? It fails the compilation on 2008,2008R2,2012 and 2014.

    😎

    I can't find any option to compile a query. Parse, yes (the query parses). Execute, yes (the query fails - "The multi-part identifier "s2.c1" could not be bound.") But compile?

    Generate the estimated execution plan 🙂

  • Jacob Wilkins (1/13/2016)


    edwardwill (1/13/2016)


    Eirikur Eiriksson (1/12/2016)


    SQLRNNR (1/12/2016)


    I dunno about the "correct" answer on this one. The statements compile for me but produce an error at run-time. Seems to be a bit of a mixup here.

    What version of SQL Server? It fails the compilation on 2008,2008R2,2012 and 2014.

    😎

    I can't find any option to compile a query. Parse, yes (the query parses). Execute, yes (the query fails - "The multi-part identifier "s2.c1" could not be bound.") But compile?

    Generate the estimated execution plan 🙂

    I did that. No compilation errors reported.

  • edwardwill (1/13/2016)


    Jacob Wilkins (1/13/2016)


    edwardwill (1/13/2016)


    Eirikur Eiriksson (1/12/2016)


    SQLRNNR (1/12/2016)


    I dunno about the "correct" answer on this one. The statements compile for me but produce an error at run-time. Seems to be a bit of a mixup here.

    What version of SQL Server? It fails the compilation on 2008,2008R2,2012 and 2014.

    😎

    I can't find any option to compile a query. Parse, yes (the query parses). Execute, yes (the query fails - "The multi-part identifier "s2.c1" could not be bound.") But compile?

    Generate the estimated execution plan 🙂

    I did that. No compilation errors reported.

    Hmmm...generates an error for me.

  • SQLRNNR (1/12/2016)


    I dunno about the "correct" answer on this one. The statements compile for me but produce an error at run-time. Seems to be a bit of a mixup here.

    +1

  • See attachment.

    Edward

Viewing 15 posts - 1 through 15 (of 26 total)

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