Print Page | Close Window

Passing date parameter to crystal from stored proc

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=15013
Printed Date: 05 May 2024 at 7:34am


Topic: Passing date parameter to crystal from stored proc
Posted By: dbodell
Subject: Passing date parameter to crystal from stored proc
Date Posted: 23 Nov 2011 at 7:18am
I know this has been asked before but I haven't been able to find an answer to this. I have Crystal 2008. I have a stored procedure which I am using as the source of my data. There are two dates in my stored procedure as parameter variables. One is FromDate and the other is ToDate.
When I define these date fields in the stored proc as type DATE, Crystal brings the parameters in as strings, making them useless for entering parameter values with a calendar control.
 
When I define the dates as DATETIME fields, Crystal interprets them as dates but requires that the time be entered along with the date.
 
This seems like a really stupid problem with Crystal, especially since SQL 2008 introduced the DATE datatype. But given that it is a problem, has anyone got a workaround somehow? I need to restrict the data on the server because of performance issues.
 
Thanks in advance for any help.


-------------
Thanks,
D. Bodell



Replies:
Posted By: lockwelle
Date Posted: 23 Nov 2011 at 11:47am
yeah, what a pain.
 
if you want to use the calendar control, use datetime. When the user selects a date, CR will put the time component in...it's only entering it manually that is a pain.
 
In your stored proc, strip off the time compent as needed or convert it to a DATE.
 
Yes, SQL 2008 has Date, but do all the other data sources that CR supports?  There are an awful lot of back ends that CR supports so I can't completely vault them for making a rule...I do wish that they would interpret a date without a time as 00:00:00 and make everyone's life easier.
 
HTH 



Print Page | Close Window