Jump to content

Getting Yymd


benjiej

Recommended Posts

Ok so I have cleaned my statement even more but now I can't get the right date format. I am looking for YYMMDD instead I am getting YYmd. I have attached the code, any help would be greatly appreciated. Basicall the error I get is it expected ) instead got ( and the cursor is put between the "Month" parenthesis and the "Cast" parenthesis.

DROP TABLE IF EXISTS Temp_Report;CREATE TABLE Temp_Report(FieldNo VARCHAR(222));INSERT INTO Temp_Report(FieldNo)VALUES('PID=xxxxxx'+' '+'XXXXXXXX'+' '+'SID=xxxxxx'+' '+'XXXXXXXX'+' '+'START'+'  '+RIGHT(CAST(EXTRACT(YEAR FROM CURRENT_DATE)AS VARCHAR(10)),2)+IF(LENGTH(MONTH)=1,'0'+MONTH,MONTH)(CAST(EXTRACT(MONTH FROM CURRENT_DATE)AS VARCHAR(10)))+IF(LENGTH(DAY)=1,'0'+DAY,DAY)(CAST(EXTRACT(WEEK FROM CURRENT_DATE)AS VARCHAR(10)))+' '+'3.0.0');

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...