• I absolutely agree with Lowell but let me give you another hint that will save much in the area of agony in the future....

    Don't use anything more than the 2 part naming convention in any of your code. Use only the 2 part naming convention. If a table is in a different database, then create a synonym that's naming using 2 part naming to point to the object in the other database.

    Why? First, it hurts nothing for performance. Second, it makes programming easier. Third, you won't have to change any of your code if you decide to move a table to different database or even rename the whole database. Instead you only need to change the synonym(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)