on 2014 Mar 14 5:19 AM
Hi Guys,
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 😞
Request clarification before answering.
well try this
IF 'Safari' IN (SELECT rest_name FROM dbo.rest_def)THEN ('AWS') ELSE ('SCT') END IF
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try this if answer 2 doesn't work
IF (SELECT rest_name FROM dbo.rest_def)='Safari' THEN 'AWS' ELSE 'SCT' END IF
BTW your original SQL also has a comma after the end if
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
64 | |
8 | |
7 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.