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!

Can format be changed forDate\Time parameters for stored procedures 1

Status
Not open for further replies.

Peas

Programmer
May 13, 2002
7
0
0
GB
Hello all,

New to this but I have searched for 2 hours.
I am using the Crystal Version 4.6 that ships with VB6 and
accessing a stored procedure in SQL 2000.

There are 2 date/time parameters in the S.P., however the format Crystal sets is :

yyyy-mm-dd hh:mm:ss.fff

which stops the procedure executing. How can I set the
parameter format to except dd-mm/yyyy ?

Thanks for you expertise.

David




 
Crystal reports insists that you send an entire datetime to a SP requesting a datetime parameter.

There are two ways that you can deal with this.

The first is to comply with its wishes. This isn't too difficult from a VB application. Have the user select a date and then just add on the time behind the scenes before sending it. You need to make certain that the time will work for the way your SP is set up.

The second is to change the SP. Instead of a datetime parameter create a varchar parameter. Use another variable to convert the varchar to a date within the SP. This adds an additional point of possible error as the varchar you send may not be a "date". If you are using code to call the report I would do a check there that the varchar is indeed a date.

Lisa

P.S. If anyone else knows of a way to only send a date to a datetime SP please let me know. This has frustrated me for years.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top