The first case will compile in the query, but when I add the second case the error below appears "Incorrect syntax near 'program'". How do I use a list for the IN clause in the update. 2008r
第一种情况将在查询中编译,但是当我添加第二种情况时,下面的错误显示“'program'附近的语法不正确”。如何在更新中使用IN子句的列表。 2008R
academic_session = CASE PC.KEY5
WHEN 'AGS' THEN 'AGS'
WHEN 'TRD' THEN 'Traditional'
END,
program = CASE PC.KEY3
WHEN PC.KEY3 IN ('FF-AGS', 'FF-TRD', 'TR-AGS', 'CH-TRD', 'CO-TRD', 'RE-TRD', 'TR-TRD', 'WDVW') THEN 'Undergraduate'
WHEN PC.KEY3 = 'CROSS' THEN 'CROSS'
WHEN PC.KEY3 = 'GR-AGS' THEN 'Graduate'
WHEN PC.KEY3 IN ('ND-AGS', 'ND-TRD') THEN 'Non Degree Seeking'
END program,
Incorrect syntax near 'program'.
'program'附近的语法不正确。
Posted each condition on a separate row and it compiles.
将每个条件发布在单独的行上并进行编译。
program = CASE PC.KEY3
--WHEN PC.KEY3 IN ('FF-AGS', 'FF-TRD', 'TR-AGS', 'CH-TRD', 'CO-TRD', 'RE-TRD', 'TR-TRD', 'WDVW') THEN 'Undergraduate' --"Incorrect syntax near the keyword 'IN'"
WHEN 'FF-AGS' THEN 'Undergraduate'
WHEN 'FF-TRD' THEN 'Undergraduate'
WHEN 'TR-AGS' THEN 'Undergraduate'
WHEN 'CH-TRD' THEN 'Undergraduate'
WHEN 'CO-TRD' THEN 'Undergraduate'
WHEN 'RE-TRD' THEN 'Undergraduate'
WHEN 'TR-TRD' THEN 'Undergraduate'
WHEN 'WDVW' THEN 'Undergraduate'
WHEN 'CROSS' THEN 'CROSS'
WHEN 'GR-AGS' THEN 'Graduate'
WHEN 'ND-AGS' THEN 'Non Degree Seeking'
WHEN 'ND-TRD' THEN 'Non Degree Seeking'
END,
1 个解决方案
#1
1
try below
academic_session = CASE PC.KEY5
WHEN 'AGS' THEN 'AGS'
WHEN 'TRD' THEN 'Traditional'
ELSE NULL
END,
program = CASE WHEN PC.KEY3 IN ('FF-AGS', 'FF-TRD', 'TR-AGS', 'CH-TRD', 'CO-TRD', 'RE-TRD', 'TR-TRD', 'WDVW') THEN 'Undergraduate'
CASE WHEN PC.KEY3 = 'CROSS' THEN 'CROSS'
CASE WHEN PC.KEY3 = 'GR-AGS' THEN 'Graduate'
CASE WHEN PC.KEY3 IN ('ND-AGS', 'ND-TRD') THEN 'Non Degree Seeking'
ELSE NULL
END ,
#1
1
try below
academic_session = CASE PC.KEY5
WHEN 'AGS' THEN 'AGS'
WHEN 'TRD' THEN 'Traditional'
ELSE NULL
END,
program = CASE WHEN PC.KEY3 IN ('FF-AGS', 'FF-TRD', 'TR-AGS', 'CH-TRD', 'CO-TRD', 'RE-TRD', 'TR-TRD', 'WDVW') THEN 'Undergraduate'
CASE WHEN PC.KEY3 = 'CROSS' THEN 'CROSS'
CASE WHEN PC.KEY3 = 'GR-AGS' THEN 'Graduate'
CASE WHEN PC.KEY3 IN ('ND-AGS', 'ND-TRD') THEN 'Non Degree Seeking'
ELSE NULL
END ,