Groups | Blog | Home
all groups > sql server reporting services > september 2004 >

sql server reporting services : Reformatting Parameters before using them in Sql query


mike
9/21/2004 4:12:42 PM
use the following custom code:

Public Function ConvertToYYYYMMDD(pYourDateFormat as Date) as String
ConvertToYYYYMMDD = Format(pYourDateFormat, "yyyyMMdd")
End Function 'ConvertToYYYYMMDD

Then in your query you would use for your parameter portion:
code.ConvertToYYYYMMDD(Parameters!YourDateParameter.Value)



[quoted text, click to view]

Urs Eichmann
9/21/2004 5:22:16 PM
Hello,
We use Reporting Services to do reports from a (rather old iSeries /
AS400) database. Date values are stored as numeric data in the format
YYYYMMDD, rather than with a proper "Date" type. This is quite common in
older host-based databases.

In one of our reports, the user should be able to select data by
entering date-from and date-to into parameters, before starting the report.

All that we are able to do right now is to let the user enter the data
in the original YYYYMMDD format, in order to be able to use it in a
parametrized query. What I want to do, is:

a) Let the user enter a date as a parameter in a proper Date format
b) Before executing the query, convert this parameter to YYYYMMDD number
format

I guess this conversion should be done in a custom assembly. However,
there doesn't seem to be a "plug" where I could attach this conversion
code. The only thing I found is to use Generic Query - but this would
really be last resort, because I think it is very ugly and not really
RAD, to lose all of the graphic helpers just because of the date
conversions.

Any help would be greatly appreciated.

Urs Eichmann
9/22/2004 2:51:57 PM
Thanks mike, but AFAIK I can only insert "code.convertto...." into my
query if I don't use the Graphic Query designer and instead use the
Generic Query Designer, which I don't want to (see my first message).

Urs


[quoted text, click to view]
Eric
3/1/2005 1:51:04 PM

Urs,

Did you ever find a work around. I am in the same boat.

Thanks, Eric


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