previous date

  • tranxdate:

    2004-11-20 00:55:41.000

    How to get the previous date(2004-11-19)?

    tranxdate - 1?

     

  • Try this:

    select dateadd(day,-1, tranxdate)

    See DATEADD in BOL for details.

    Greg

     

     

    Greg

  • Thanks Greg!

    Can you include your user defined function in DATE FUNCTION?

    select dateadd(day,-1, MaxLoginTime('2004-11-20 00:55:41.000'))

    got error msg:

    Server: Msg 195, Level 15, State 10, Line 1

    'MaxLoginTime' is not a recognized function name.

  • You need to qualify your function name...   DBName.ownername.MaxLoginTime()

    Steve

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply