• Rehan Ahmad (11/14/2016)


    Thanks Eirikur Eiriksson & Luis Cazares,

    It works.:-)

    By this way, we made a series where either 6 digits are same. Did we could do its alterate in SQL 2000. Further, if we need to do its opposite i.e. we have a series of total 7 digits and requirment is to find and mark those numbers which contains 6 same digits either in xyyyyyy or yyyxyyy format. Then what will be the approach for this.

    Sample:

    Number Remarks

    1222222 Six Digits

    2204444 Not Six Digits

    .......

    This is wrong. It violates 3rd normal form and your code will suffer in many ways further down the road. You should have two separate columns to 1) make searching easier and SARGable and 2) to take advantage of storing the data in the correct numeric datatype. The only time you should mush the data together is for display purposes. If you wanted to, you could use a persisted computed column for the mushing.

    --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)