I need some help here. I'm trying to put a logical statement into my output statement but apparently it doesn't work. Script as below:
UNLOAD SELECT REPLACE((SUBSTRING(dbo.dly_srv_prd_trk_ttl.business_date,1,7)),'-','0'), DATEFORMAT(dbo.dly_srv_prd_trk_ttl.business_date,'dd/mm/yyyy'), dbo.dly_srv_prd_trk_ttl.trk_ttl_01, DATEFORMAT(dbo.dly_srv_prd_trk_ttl.business_date,'dd'), dbo.dly_srv_prd_trk_ttl.rvc_seq, IF (SELECT rest_name FROM dbo.rest_def)='Safari' THEN SELECT STRING('AWS') ELSE SELECT STRING('SCT') END IF, FROM dbo.dly_srv_prd_trk_ttl TO 'D:\SUN\DATA.txt' FORMAT FIXED
I have tested each of the statement inside and they are working when running alone. Error prompts "Syntax error near 'SELECT' on line 7".
Please help :(
asked 14 Mar '14, 05:19