Link to home
Start Free TrialLog in
Avatar of Gerhardpet
GerhardpetFlag for Canada

asked on

Need help with query for Pervasive

I have a query that I want to use for extracting data form a Pervasive database and then insert to a table.

This is the first part of the query which works in PostgreSQL

SELECT d.whse, d.part_no, EXTRACT(YEAR FROM d.invoice_date), EXTRACT(MONTH FROM d.invoice_date)
FROM sales_history_items AS d

Open in new window


In Pervasive the invoice_date is a string like so 20141128

Can someone help me with this? Once I got this working I will post the whole query is I need more help.
Avatar of Mirtheil
Mirtheil
Flag of United States of America image

I'm guessing the problem with Pervasive is the EXTRACT part.  If that's not the case, post the version of Pervasive and the error you are seeing.  
If it is the EXTRACT, the Pervasive syntax for EXTRACT (in v10 and v11, at least) is:
EXTRACT (extract_field, extract_source)

Open in new window

So your query would be :
SELECT d.whse, d.part_no, EXTRACT(YEAR, d.invoice_date), EXTRACT(MONTH, d.invoice_date)
FROM sales_history_items AS d

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Bill Bach
Bill Bach
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial