Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Stored procedure with parameter Post Reply Post New Topic
Author Message
shannon_lp
Newbie
Newbie
Avatar

Joined: 11 Jul 2013
Location: United States
Online Status: Offline
Posts: 3
Quote shannon_lp Replybullet Topic: Stored procedure with parameter
     Posted: 11 Jul 2013 at 9:06am

I’m attempting to use a stored procedure in my Crystal Report.  In my stored procedure I have parameter that I’ve defined as a date.  However, Crystal Reports is recognizing it as a string.

When I refresh the report and uncheck ‘Set to Null’ and enter a date I get the following error:

“Failed to retrieve data from the database.  Database Connector Error: ‘Procedure date_store expects parameter @dateparam, which was not supplied.”

I believe the syntax in my stored procedure is correct.  Is there something on the Crystal Reports side I need to configure so that recognized that the @dateparam is a date, not a string? 

I’m pasted my stored procedure below.  I'm using Crystal Reports 12.  Any help would be greatly appreciated.

create PROC dbo.date_store (@dateparam date)

AS

DECLARE @eff_date date

if @dateparam is null

select @eff_date = prev_bus_date from dbo.metric_sys_date

else

select @eff_date = @dateparam

 

select metric_collct.collct_desc, metric_collct.notes_desc, metric_collct_catgry.catgry_name, metric_hist.eff_date, metric_hist.numeric_qty, metric_hist.datetime_dttm, metric_hist.notes_text, metric_hist.hist_dttm

FROM

prod01.dbo.metric_collct metric_collct,

prod01.dbo.metric_collct_catgry metric_collct_catgry,

prod01.dbo.metric_hist metric_hist

WHERE

metric_collct.catgry_id = metric_collct_catgry.catgry_id AND

metric_collct.collct_id = metric_hist.collct_id AND

metric_collct_catgry.catgry_name = 'DCS' AND

metric_hist.eff_date = @eff_date

go

IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 11 Jul 2013 at 11:22am
Which version of Crystal are you using?  Try changing the parameter from a Date type to a DateTime type. I think that some versions of Crystal don't "see" the Date type in SQL Server.
 
-Dell
IP IP Logged
shannon_lp
Newbie
Newbie
Avatar

Joined: 11 Jul 2013
Location: United States
Online Status: Offline
Posts: 3
Quote shannon_lp Replybullet Posted: 11 Jul 2013 at 12:05pm
I'm using CR 2008 and connecting to Sybase.
IP IP Logged
shannon_lp
Newbie
Newbie
Avatar

Joined: 11 Jul 2013
Location: United States
Online Status: Offline
Posts: 3
Quote shannon_lp Replybullet Posted: 12 Jul 2013 at 3:30am
Changing my parameter in my stored procedure to datetime worked. Thanks for your help.
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum