Jump to content

Date Extract


benjiej

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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...