Jump to content

Date Extract


benjiej
 Share

Recommended Posts

I have been trying to get this query to work all day and I have read all the forums and tried all the docs and still I am stumped. Should just be a simple extract but I am also concatenate several items in the same line of code. I am using DBIsam 4.21

DROP TABLE IF EXISTS Temp_Report;CREATE TABLE Temp_Report(FieldNo VARCHAR(222));INSERT INTO Temp_Report(FieldNo)VALUES('PID=XXXXXX',' ','XXXXXXX',' ','SID=XXXXXX',' ','XXXXXXXX',' ','START','  ',+CAST(EXTRACT(YEAR FROM CURRENT_DATE) AS VARCHAR(10))+CAST(EXTRACT(MONTH FROM CURRENT_DATE) AS VARCHAR(10))+CAST(EXTRACT(WEEK FROM CURRENT_DATE) AS VARCHAR(10))),' ','3.0.0';;FROM blah

Ok I found it really early this morning this is what I ended up doing.

INSERT INTO Temp_Report(FieldNo)VALUES('PID=xxxxxx'+' '+'XXXXXXX'+' '+'SID=xxxxxx'+' '+'XXXXXXXX'+' '+'START'+''+CAST(EXTRACT(YEAR FROM CURRENT_DATE) AS VARCHAR(10))+CAST(EXTRACT(MONTH FROM CURRENT_DATE) AS VARCHAR(10))+CAST(EXTRACT(WEEK FROM CURRENT_DATE) AS VARCHAR(10))+' '+'3.0.0')

Cleaned up a little bit and removed the FROM statement.

Edited by Benjie
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...