date

  • I have proc which picks date from a table where it has fixed date as 1st day of the month say

    ' 03/01/2010' but i have to populate last day of that month in my report, how do i do that ?

    example : if i get 04/01/2010 i have to popupate that as 04/30/2010 but as you know every month has diffferent end date.

  • DECLARE @StartDate DATETIME

    SET @StartDate = '2010/03/01'

    SELECT DATEADD(dd,-1,DATEADD(mm,1,@StartDate))

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Tara,

    In case that logic is not obvious to you, the idea is that although the end date of the month is variable, it is always the day before the first day of next month...

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

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