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!

Converting text to date in Pervasive

Status
Not open for further replies.

datenis

Programmer
Jan 22, 2002
98
0
0
CA
I have built a date conversion query first in MS SQL, ran it and it works. Then I tried to run it on Pervasive, but it doesn't work.

How does date time conversion work in Pervasive?

Can anyone show me a sample going from a text string "yyyymmdd" to a date in pervasive?

Thanks in advance

-D
 
The format used by Pervasive is 'yyyy-mm-dd' (And you need the single quotes).


Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
Custom VB and Btrieve development.
 
Hi,

Here is the query I built
Code:
select 
CONVERT(datetime, 
        left(inv_chgn_date,4) + '-'+ 
        right(left(inv_chgn_date,6),2) + '-' + 
        right (inv_chgn_date,2))  
from inv_info

Whenever I run it I get the following message:
The second parameter inv_chgn_date for CONVERT is invalid.

Can you tell me what's wrong?

Thanks,

-D
 
CONVERT on PSQL is:
CONVERT (expression, data type)
So your query should be:
select
CONVERT(left(inv_chgn_date,4) + '-'+
right(left(inv_chgn_date,6),2) + '-' +
right (inv_chgn_date,2), SQL_DATE)
from inv_info



Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
Custom VB and Btrieve development.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top