Showing posts with label key. Show all posts
Showing posts with label key. Show all posts

Thursday, March 22, 2012

Date Parameter ERROR

My RS has two date parameters setup as a date data type. If the user was to
key in 01102004 instead of 01/10/2004 they get this error;
Reporting Services Error
"The value provided for the report parameter 'P_FromDate' is not valid for
its type. (rsReportParameterTypeMismatch)"
How can set that parameter up so I can enter in either of the above dates
formats? I need to beable to do error handling on these two fields.Have the parameter be of string type and then base your query on a dynamic
sql (an expression). The expression can call code that parses the date. But
if it is a bad date it gets tricky to give an error message. To have more
control of the parameters you would need to have your own asp page that is
used to get the parameters and then use either URL integration or web
services to integrate with RS.
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"doug" <doug@.discussions.microsoft.com> wrote in message
news:44D70CDD-0EF9-4BA1-82F0-ADFD748E45D8@.microsoft.com...
> My RS has two date parameters setup as a date data type. If the user was
to
> key in 01102004 instead of 01/10/2004 they get this error;
> Reporting Services Error
> "The value provided for the report parameter 'P_FromDate' is not valid for
> its type. (rsReportParameterTypeMismatch)"
> How can set that parameter up so I can enter in either of the above dates
> formats? I need to beable to do error handling on these two fields.

Tuesday, February 14, 2012

Date as part of primary key?

I have three items which make up the primary key:
ProjectNumber, Hardware, Date
Problem: The Date is formatted with date and time, how can I add a record and use just the date?
Currently I use GetDate() in my stored proc.
Mike BDates are not stored in any particular format. They are stored as a numeric value that indicates the number of days elapsed from a baseline date and the number of seconds elapsed since midnight (the decimal portion).

If you only want to store the whole-date portion, then instead of storing getdate store the results of this expression:

convert(char(10), getdate(), 120)

This will yield a time value equal to midnight. It's up to your interface to determine how the value is displayed.|||Dates are not stored in any particular format. They are stored as a numeric value that indicates the number of days elapsed from a baseline date and the number of seconds elapsed since midnight (the decimal portion).

If you only want to store the whole-date portion, then instead of storing getdate store the results of this expression:

convert(char(10), getdate(), 120)

This will yield a time value equal to midnight. It's up to your interface to determine how the value is displayed.
Exactly what I wanted, thank you!

Mike B