all groups > sql server reporting services > march 2006 >
You're in the

sql server reporting services

group:

Date function to extract start date



Date function to extract start date Edgar
3/11/2006 11:27:03 AM
sql server reporting services: Hello,

I was wondering if there is a date function to determine a starting
date based on a @EndDate
parameter. In other word, if my user chose an end date of 3/31/2006, I
want to get a start date of 4/1/2005.

I appreciate any suggestion.

Edgar J.
Re: Date function to extract start date FatOaf
3/12/2006 7:58:55 PM
You can use another query to provide a default for the second parameter
using the 1st as input.

If its sqlserver you can use (I may have syntax slightly wrong as Im
not looking this up now).

SELECT [StartDate] = dateadd(day, dateadd(year, @EndDate, -1), 1)

In other words return just 1 row , 1 column with a date.
Use sqlserver dateadd function to subtract 1 year and again to add 1
day.



[quoted text, click to view]
AddThis Social Bookmark Button