Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2012
    Posts
    3

    Equivalent of LAST_DAY function in sybase

    Dears,
    Does anybody knows the equivalent of LAST_DAY function in sybase

    Thanks

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,353
    You can create a function to return the last day of the month
    Code:
    CREATE FUNCTION last_date(@fdate DATETIME)
    returns DATETIME AS
    RETURN dateadd(dd,-1,dateadd(mm,datediff(mm,'',@fdate)+1,''))
    Then use it like this
    Code:
    SELECT name, crdate, dbo.last_date(crdate) FROM sysobjects

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •