• I ran your code from the previous post... here it is, again...

    select getdate()

    select dbo.CalcTimeBetweenTwoDates('2004-11-16 15:30', '2007-11-21 07:31')

    select getdate()

    Here's what I get for an error message from that code...

    Msg 4121, Level 16, State 1, Line 1

    Cannot find either column "dbo" or the user-defined function or aggregate "dbo.CalcTimeBetweenTwoDates", or the name is ambiguous.

    Looking at the code from your good article, I see no function called dbo.CalcTimeBetweenTwoDates. I'm still looking, though.

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