Jump to content

Getting Yymd


benjiej
 Share

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

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...