Forum Replies Created

Viewing 15 posts - 3,151 through 3,165 (of 3,957 total)

  • RE: T-SQL Help

    While BrainDonor's (love that name) suggestion will work, I find the UNPIVOT syntax so unwieldy (especially on double and triple UNPIVOTs) that I like to steer people towards the CROSS...

  • RE: INSERT AND UPDATE WITH IF EXISTS

    First off, you should probably be using MERGE for this.

    Second, in a high transaction database, using IF EXISTS followed by UPDATE/INSERT as you are doing is quite dangerous because some...

  • RE: error when using while in select script

    Using only the stone knives and bear skins available in SS2K, I think this will run without error on that ancient platform, and may produce something somewhat close to what...

  • RE: error when using while in select script

    Let me apologize for my original bone-headed post. Not only did I screw up the syntax (I blame my current cognitive overload), I failed to notice that you're using...

  • RE: UNPIVOT an flat Tabel

    Evil Kraig F (7/24/2012)


    Would it be possible to provide the schema, some sample data, and the expected results from that data? The first question was simple enough to extrapolate...

  • RE: error when using while in select script

    OK I see the DDL now, sorry I missed it earlier.

    Sample data can be done with an INSERT like as follows:

    INSERT INTO dbo.Table

    SELECT 1,2,3,4 -- As many...

  • RE: Get running total in the following query

    Jeff Moden (7/23/2012)

    I've not found rCTE's to be very fast at very much.

    I know you're a busy guy Jeff, so you must've missed my rCTE solution to the Sweden redistricting...

  • RE: UNPIVOT an flat Tabel

    gert.lindholm (7/23/2012)


    Hi again Dwain

    When i was yunger i also loathe my name.

    But older i get i get used to it.

    My middle name is Erik.

    And i´m named by an old...

  • RE: error when using while in select script

    xmozart.ryan (7/23/2012)


    dwain.c (7/23/2012)


    Assuming you want one result set returned to your client, you should consider doing it something like this:

    ;WITH Tally (n) AS (

    ROW_NUMBER() OVER (ORDER...

  • RE: Get running total in the following query

    XMLSQLNinja (7/23/2012)


    Just got back from vacation and wanted to address this one first...

    I must be missing something but I don't see how that recursive CTE (as much as I...

  • RE: Hierarchical Query to Return All Children

    GSquared (7/23/2012)


    dwain.c (7/23/2012)


    GSquared (7/19/2012)


    Jeff Moden (7/17/2012)


    GSquared (7/17/2012)


    He was talking about the last solution I posted. That's a while-loop version.

    First, apologies for not responding sooner. I've actually be working...

  • RE: UNPIVOT an flat Tabel

    Gert - You're most welcome.

    I have a brother named Gert, although he is loathe to use that name. He uses his middle name instead.

  • RE: I need help determining the factuality of code commentary

    We seem to be overlooking the cardinality rule of comments:

    "Comments in code are always out of date and hence inaccurate."

    Could be this used to apply but does no more.

    I like...

  • RE: error when using while in select script

    Assuming you want one result set returned to your client, you should consider doing it something like this:

    ;WITH Tally (n) AS (

    ROW_NUMBER() OVER (ORDER BY (SELECT...

  • RE: Hierarchical Query to Return All Children

    GSquared (7/19/2012)


    Jeff Moden (7/17/2012)


    GSquared (7/17/2012)


    He was talking about the last solution I posted. That's a while-loop version.

    First, apologies for not responding sooner. I've actually be working on a...

Viewing 15 posts - 3,151 through 3,165 (of 3,957 total)