Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Parameter in SQL bombs in crystal report

Status
Not open for further replies.

vcujackson

Technical User
Apr 7, 2009
18
0
0
US
I prepared the following as a stored procedure using a date parameter. I then pass it over to a crystal report. When I try and open the report in crystal 2008 it prompts me the the @GifteffdatBegin and @GifteffdatEnd date as it should. It prompts me to insert the date as follows mm/dd/yyyy 00:00:00:00 or datetime format. When I do this I get an invalid argument message. This leads me to conclude that I have done something wrong in coding on the sql procedure side. Please look at the code and tell me if there are errors that would cause this issue. AM I going to need to declare the parameter in addition to listing it in the beginning of the procedure???

ALTER PROCEDURE [dbo].[NGP_Parameter]

-- Add the parameters for the stored procedure here
@GifteffdatBegin datetime,--beginning date
@GifteffdatEnd datetime --ending date
AS

SELECT giftkey,giftid,gifteffdat
FROM gift_table
WHERE gifttype = 'a'
AND gifteffdat >= @GifteffdatBegin
AND gifteffdat <=@GifteffdatEnd
 
Is that entire procedure? If not it would be worth showing it all.

Try calling the procedure in query analyser (or equivalent) with the parameters you are using and see if you get an error.

Try entering dates of '01/01/2009' and '10/01/2009'. If this works it may mean that Crystal Reports is using a date format that is not the same as SQL Server.

Another option would be to post this question in a Crystal Reports forum.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top