Forum Replies Created

Viewing 15 posts - 16,816 through 16,830 (of 59,067 total)

  • RE: Searching set of words by ignoring spaces

    Alan.B (8/25/2016)


    ScottPletcher (8/25/2016)


    Rather than literal strings of spaces, I recommend using SPACE(), just for readability:

    /*CREATE FUNCTION ...*/

    SELECT REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(LTRIM(RTRIM(@Text)),

    SPACE(33), ' '),

    SPACE(17), ' '),

    ...

    --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: Shrinking a large DB

    MiguelSQL (9/15/2016)


    We would need to do this several times a year (bad idea... I know)

    I'm not sure why anyone would think that's a bad idea unless there were some PII...

    --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: Shrinking a large DB

    TheSQLGuru (9/15/2016)


    I don't think you need to shrink it to share it with a bunch of developers efficiently. Go get a copy of Redgate's SQL Clone.

    http://www.red-gate.com/products/dba/sql-clone/

    https://www.simple-talk.com/sql/sql-tools/clone-sweet-clone-database-provisioning-made-easy/

    Tell Richard I sent...

    --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: The Danger of xp_cmdshell

    Heh... I think I'm being prodded to publish. 😀

    --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: Index guidance needed

    MickyD (9/15/2016)


    Thanks everyone for the prompt replies.

    I have been given a selection of queries from the users.

    As an example a very basic select returns (669484 row(s) affected) in around 5...

    --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: Index guidance needed

    MickyD (9/15/2016)


    As an example a very basic select returns (669484 row(s) affected) in around 5 mins.

    Hold the phone a minute... WHERE are those rows being returned to? What does...

    --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: Index guidance needed

    MickyD (9/15/2016)


    Hi everyone.

    I recently came across a dev database in our organization that had no clustered indexes and circa 100 million row.....:crazy:

    In order to rectify I need some advice on...

    --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: A Case FOR Cursors...

    Took a quick look, Hugo. Looks great and I don't actually have to figure out how to write a Cursor (I think I've done it only 2 or 3...

    --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: A Case FOR Cursors...

    Hugo Kornelis (9/15/2016)


    Jeff Moden (9/14/2016)


    Hugo Kornelis (9/12/2016)


    What I should have written was "a WHILE loop, no matter how well written it is, will never ever beat a (well written) cursor".

    Do...

    --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: Add million of records

    sqlenthu 89358 (9/15/2016)


    Jeff Moden (9/14/2016)


    sqlenthu 89358 (9/14/2016)


    Hi all, I have to transfer around 50 million records from one table to another. What should be the best approach. I know it...

    --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 Columns to Rows

    tripleAxe (9/15/2016)


    Some basic testing on my VM using the original table as posted but with 12 million rows of data has the UNION ALL query taking 6 seconds with 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: Urgent!!Need to write a sql script

    patilpallavi16 (9/13/2016)


    I have the following sql query:

    declare @naiccode int = 12345

    SELECT Policy.policyType, Policy.policyNum, Policy.effectiveDate, '12345' AS "NAIC Code" ,

    Insured.lname1, Insured.middle1,

    Insured.fname1, Insured.address1, Insured.city, Insured.state, Insured.zip FROM Policy FULL JOIN

    Insured ON...

    --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: A Case FOR Cursors...

    Hugo Kornelis (9/12/2016)


    What I should have written was "a WHILE loop, no matter how well written it is, will never ever beat a (well written) cursor".

    Do you have some readily...

    --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: Down Tools Week 2016

    From the Article:


    An organization wouldn't need to cater food every night.

    Night? Free brainstorming for the company and it's at night?

    I've heard of "Down Tools" or "Down Weeks" before but there's...

    --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: Temporary tables

    That is unless the temp table starts with two "#" signs, which makes it a "Global Temp Table", and then the answer would be "yes".

    --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 - 16,816 through 16,830 (of 59,067 total)