Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Stactic String Parameters parsed into date error Post Reply Post New Topic
Author Message
robtyketto
Newbie
Newbie
Avatar

Joined: 13 Jul 2009
Online Status: Offline
Posts: 12
Quote robtyketto Replybullet Topic: Stactic String Parameters parsed into date error
    Posted: 16 Aug 2011 at 2:02pm
Greetings,
 
My crystal reports datasource is a stored proc (SQL server 2005) that expects 2 parameters:
@startDate varchar,
@endDate varchar
 
These are converted to a datetime in the stored proc as follows:
W.WeekEnd >= Convert(datetime, @startDate, 20)
 
When I set the stored proc as the datasource it prompts for values for both fields which I enter as follows:
2011-08-01 00:00:00
2011-08-17 00:00:00
 
This results in the error
Conversion failed when converting datetime from character string.
 
In t-sql if I run the exact same command in the stored proc it runs and returns a date e.g.
 
Select Convert(datetime, '2011-08-01 00:00:00', 20) as RobsTime
2011-08-01 00:00:00.000
 
Hope someone can advise me of why the error is occuring, I'm baffled.
 
Thanks
Rob
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 17 Aug 2011 at 2:30am
run a trace (profiler) on what CR is sending to your proc.  Once you have the parameters, you can then work to modify the proc to perform correctly.
 
Running the proc with the parameter information will also give a line number of where the error is...it might be somewhere you didn't expect
 
HTH
IP IP Logged
robtyketto
Newbie
Newbie
Avatar

Joined: 13 Jul 2009
Online Status: Offline
Posts: 12
Quote robtyketto Replybullet Posted: 18 Aug 2011 at 3:39am
Originally posted by lockwelle

run a trace (profiler) on what CR is sending to your proc.  Once you have the parameters, you can then work to modify the proc to perform correctly.
 
Running the proc with the parameter information will also give a line number of where the error is...it might be somewhere you didn't expect
 
HTH


Thanks for the advice I ran the SQl profiler and the value was passed in as expected.

I didn't fully test the store procedure and the issue was a t-sql issue when I declared the varchar variable as I didn't specify the length.

Thanks Smile
Thanks
Rob
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.035 seconds.