×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Converting text to date in Pervasive

Converting text to date in Pervasive

Converting text to date in Pervasive

(OP)
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

RE: Converting text to date in Pervasive

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.
http://www.mirtheil.com

RE: Converting text to date in Pervasive

(OP)
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

RE: Converting text to date in Pervasive

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.
http://www.mirtheil.com

RE: Converting text to date in Pervasive

(OP)
It works, thanks Mirtheil!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close