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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

string to date conversion error

Status
Not open for further replies.

simpelli

Programmer
Jul 2, 2003
30
US
I'm creating a Crystal Report (v9) against an informix db using a command object (query) with two date parameters. I'm having trpuble with the WHERE clause in my query:

"WHERE DATE(tbl.datetimefield) >= {?Begin Date}
AND DATE(tbl.datetimefield) <= {?End Date}&quot;

tbl.datetimefield is stored as &quot;yyyy-mm-dd hh:mm:ss&quot;

I keep getting a &quot;string to date conversion error&quot; message when attempting to validate the query.

Occasionally I'll get &quot;non-numeric characters in date time string&quot;


Any help?

 
Hi,

You have enclosed your date variable with { ie, curly bracket, instead use single or double quotes.

An example below demonstrates various syntax:
create temp table x (t1 datetime year to second) with no log;
insert into x values ( current );
select t1 from x where t1 <= date('17122003');
select t1 from x where date(t1) <= '17122003';
select t1 from x where t1 <= extend(date('17122003'),year to second);

Regards,
Shriyan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top