Forum Replies Created

Viewing 15 posts - 2,071 through 2,085 (of 6,036 total)

  • RE: problem in select command

    David Webb-200187 (3/18/2013)


    From the MS site:

    A common table expression can be thought of as a temporary result set that is defined within the execution scope of a single SELECT, INSERT,...

  • RE: problem in select command

    Eugene Elutin (3/18/2013)


    First of all it's not quite polite to put statements in foreign language on English forum without translation. So, here we are:

    As you pointed out this proverb does...

  • RE: problem in select command

    Sean Lange (3/18/2013)


    Yes I don't think there is a clear cut advantage for either approach as far as performance is concerned. I think it boils down to preference.

    If you come...

  • RE: problem in select command

    Another one:

    http://sqlblogcasts.com/blogs/tonyrogerson/archive/2008/05/17/non-recursive-common-table-expressions-performance-sucks-1-cte-self-join-cte-sub-query-inline-expansion.aspx

    I have some questions about it, though.

    Will do some excersises around it, when have some spare time.

  • RE: problem in select command

    Sean Lange (3/18/2013)


    Of course a CTE can use tempdb. Just like a temp table, if the memory pressure is too much it will absolutely start writing data to tempdb.

    What would...

  • RE: problem in select command

    Lynn Pettis (3/18/2013)


    So a derived table in a FROM clause would have the same problem, wouldn't it.

    It would seem that a view would also have the same issue as well.

    Definitely...

  • RE: problem in select command

    Sean Lange (3/18/2013)


    Of course a CTE can use tempdb. Just like a temp table, if the memory pressure is too much it will absolutely start writing data to tempdb.

    Hmm...

    I saw...

  • RE: problem in select command

    Sean Lange (3/18/2013)


    This type of discussion comes up around here over and over. Should we use a subquery or a cte. In cases like this they almost always proven to...

  • RE: problem in select command

    Eugene Elutin (3/18/2013)


    :w00t::w00t::w00t::w00t::w00t:

    "extra words" is a greatest argument to declare a "code" winner I'have ever seen.

    Did you find anything else different?

    Anything?

    If you missed it - I responded on this statement:

    Lynn...

  • RE: interesting query

    AllanP999 (3/15/2013)


    Phil's solution sorted it out thanks

    So, your answer on my question was not correct:

    So the answer to your question is I am only interested in rows 1-13 and not...

  • RE: problem in select command

    Lynn Pettis (3/17/2013)


    So, does the extra typing make it more complex? I think it makes the query more understandable.

    Extra typing always makes anything more complex.

    By definition.

    More typing - more...

  • RE: problem in select command

    The plans looks identical.

    No difference here.

    So, the oonly difference left is in extra wording you need to write every time when you use CTE instead of a simple derived table.

    😎

  • RE: problem in select command

    Lynn Pettis (3/17/2013)


    Really, CTEs are complex? I find them to make writing queries easier as you don't have to write derived tables.

    🙂

    Let's compare:

    ;WITH MyData AS (

    ...

  • RE: Merging two select statements for MTD and YTD

    I guess a query WITH ROLLUP would allow avoiding double-run.

    Then a row with grouping on YEAR column would contain aggregated values from all rows with grouping on month.

  • RE: Insert Performance

    Grant Fritchey (3/13/2013)


    But a few years ago, I did do a series of tests, not from ODBC, but through ADO.NET, and we saw serious performance degradation when using single inserts...

Viewing 15 posts - 2,071 through 2,085 (of 6,036 total)