Forum Replies Created

Viewing 15 posts - 44,806 through 44,820 (of 59,095 total)

  • RE: Find out duplicate rows from multiple table

    SQL_Quest (3/5/2009)


    Jeff Moden (3/4/2009)


    ... and, no... sorry... I don't know how to write a script to do it for 300 different tables auto-magically... no way to know which columns make...

    --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 bit of an abstract problem

    Punketal (3/5/2009)


    It was mostly to do with U/I presentational stuff, showing how many had graduated from the school itΒ΄s first and last years.

    I solved it with some VB programming so...

    --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: Sum of previous rows till this row.

    souLTower (3/5/2009)


    Jeff, quick question. Since I used a clustered index couldn't I "assume" that the order would be as I want it?

    I know to never assume...

    ST

    Correct... never assume unless...

    --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 generate Dates on the fly

    Jeff Moden (3/5/2009)


    Bob Hovious (3/5/2009)


    JEFF !!!! You don't have a tally table available?

    select dateadd(yy,datediff(yy,0,getdate())-5,0)+ N-1

    from dbo.tally

    where N < datediff(dd,dateadd(yy,datediff(yy,0,getdate())-5,0),getdate())+2

    Runs almost a full millisecond faster at 5-10 years....

    --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 generate Dates on the fly

    NY153 (3/5/2009)


    No systables as well πŸ™

    And tables available don't have seqeunce numbers. They some id columns, but not perfect.

    Very very limited access

    The sys tables don't need to have any...

    --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 generate Dates on the fly

    Bob Hovious (3/5/2009)


    JEFF !!!! You don't have a tally table available?

    select dateadd(yy,datediff(yy,0,getdate())-5,0)+ N-1

    from dbo.tally

    where N < datediff(dd,dateadd(yy,datediff(yy,0,getdate())-5,0),getdate())+2

    Runs almost a full millisecond faster at 5-10 years. πŸ˜‰

    Pretty...

    --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: "Answered" Posts

    KevinC. (3/5/2009)


    I really like having the OP state whether a particular answer helped them or not and why. I know it helps me when I'm trying to figure out...

    --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 generate Dates on the fly

    Thanks Dugi! Great way to start the day!

    --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: BCP Format File

    Not exactly... post the first 5 rows of one of the data files you intend to import with this and we'll show you how...

    --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 generate Dates on the fly

    NY153 (3/4/2009)


    How generate Dates on the fly? At runtime for the last 5 years, current year -5 starting from 1st Jan.

    I needed for the left JOIN, so I can get...

    --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: Update a table by selecting the max record

    Chirag (3/4/2009)


    You cant do the Select & Update in a single query.

    Ummm... I'm pretty sure you can... see Glenn's post above. That's one of the reasons I love SQL...

    --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: Create a daily record from date ranges

    Heh... must be budget planning time again. This should do it, John.... I'm using Master.dbo.spt_Values as if it were a Tally table...

    DECLARE @Description VARCHAR(20),

    ...

    --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: Problems sending string parameter to a SP

    GSquared (3/4/2009)


    The fastest way I know of to parse a simple string like that is to convert it to XML and then query that. That only works if you're...

    --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 bit of an abstract problem

    Punketal (3/4/2009)


    That worked cheers mate...

    one more question, say I wanna take first and last year and skip all the ones in the middle?

    Just curious... why would you need to 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: a<>b OR not(a=b)

    jungnaja (3/4/2009)


    Thanks everyone!

    I personally prefer a<>b, but we have a senior programmer at work who loves not(a=b).....not(Is Null).....not(whatever). I can't just say it's difficult to debug 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)

Viewing 15 posts - 44,806 through 44,820 (of 59,095 total)