Forum Replies Created

Viewing 15 posts - 18,976 through 18,990 (of 59,072 total)

  • RE: T-SQL split string and Pivot

    @aaron.reese,

    You have these 4 fields that contain hierarchical pipe delimited data and you've realized that's not the best structure for querying (it's called a "Hierarchical Path" or "Sort Path").

    The question...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: T-SQL split string and Pivot

    Luis Cazares (12/11/2015)


    Other than using a different function, the final code is basically the same. The only problem is that you're not using the fastest function available (even in the...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Rebuild Inxexes after archive best option?

    Welsh Corgi (12/11/2015)


    Is rebuilding Indexes the best alternative after archiving a lot of data or is there a better alternative?

    If the archiving is being done based on a date column,...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Combining four while looping into one

    koti.raavi (12/12/2015)


    I want to combine four while loops into,any help greatly appreciated

    drop table #cad

    /*GETTING THE REQUIRED MONTHS FOR PERFORMING THE FURTHER CALCULATIONS*/

    SELECT [FINALEID],ResourceHome,[ROLLOFFDATE] ,PROJECT,CLIENT,ENGAGEMENT,WBSE

    INTO #CAD

    FROM CRD

    ORDER...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Can't Shrink Transaction Log 79 GB

    Welsh Corgi (12/12/2015)


    pietlinden (12/12/2015)


    I would check Paul Randal's blog for some ideas. Maybe start here: Troubleshooting Transaction Log Growth[/url]

    I tried it but no success.

    Very specifically, what did you try...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Multiple Executions of a Scalar Function in a single call of stored procedure

    Someone is going to have to rewrite the proc to use iTVFs instead of scalar functions. It's the only way other than using something like a Temp Table to...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: How to pad a string with spaces when size of data is unknown

    ChrisM@Work (12/10/2015)


    Jeff Moden (12/9/2015)


    ChrisM@Work (12/9/2015)


    suvesh.sonker 2691 (12/9/2015)


    -- Ten digit

    Declare @field as varchar(20) = '559'

    Select Replace(right(replicate(' ',10) + @field ,10),' ','0')

    In what circumstances might this be preferable to the simpler SELECT...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Convert Rows into Columns

    Larry.Hennig (12/11/2015)


    Lol! That would be more of a challenge! But still doable - you would have to calculate page numbers. A high-volume scenario would be another special case....

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Convert Rows into Columns

    Ok... I realize that this is an older thread but people are still posting PIVOTs to do this and that's going to be slower than a good CROSSTAB. The...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Convert Rows into Columns

    Larry.Hennig (12/11/2015)


    Columnar output that is row-ordered is difficult to read,

    I absolutely agree with that but only if such order is confined to individual pages. Just for grins, try...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Convert Rows into Columns

    seebert42 (12/11/2015)


    Unfortunately no, but what I have discovered is it can be done without cursors. Pseudo code is use a select to build your create Table statement, then an...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Convert Rows into Columns

    steven.bingham (7/18/2014)


    You're usage of row_number(), modulo and such is impressive, but I

    must admit that I found the solution a bit over complex and it was making

    my head hurt...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Convert Rows into Columns

    zerbit (7/18/2014)


    I dislike the solution proposed, it's far too complicated to reach a so easy task.

    You requirement was to print 3 lots at a time per line of document. This...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Convert Rows into Columns

    fregatepllada (7/17/2014)


    Thanks Luis, I hate to bring another dimension to performance test but I am using TABLE variable, not temporary table. 😉

    Where's that code? I'll add it to the...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Convert Rows into Columns

    fregatepllada (7/17/2014)


    Luis, if we talking about performance difference did you try to benchmark your approach vs PIVOT?

    IFAIK PIVOT became part of built-in SQL Server functionality since SQL Server 2005....

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 15 posts - 18,976 through 18,990 (of 59,072 total)