Help in understanding begin and end dates what they doing

  • SET @EndDate = ( SELECT Max(d.End_Dt) FROM dbo.date d

    WHERE d.End_Dt < getdate() )

    SET @BeginDate = DATEADD(mm,-12,@EndDate)

  • There's a table of dates (presumably), dbo.date.

    The first SET command sets the @EndDate variable to be the most recent date from the dbo.date table that is earlier than the current datetime.

    The second SET command sets @BeginDate to 12 months before @EndDate.

    Cheers!

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

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