Friday 15 November 2013

SSRS Report: Date addition, subtraction

Scenario: 
I want to subtract 7 days from the date I choose in the date parameter

Solution:
In the expression write=Dateadd("d",-7,Parameters!RefDate.Value)

Scenario:
I want just change the year part of the Date field. Changing 365 days does not work because of the leap year.

Solution:
SQL Command:

UPDATE dbo.TableToUpdate
  SET [Date Column] = DATEADD(YEAR, -2, [Date Column]);

SSRS Command:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home