我想使用new_BantuanKewangan
从STU_TYPC
表更新CASE
:
UPDATE DMSTAG.dbo.TEMP_AKAUN_MARA
SET [new_BantuanKewangan] = [STU_TYPC]
FROM [SMBM_DBPELJ].[DBPELJ].[MSTUMASTER]
(CASE
when [new_BantuanKewangan] = '00' then 'Yes'
when [new_BantuanKewangan] = '01' then 'No')
where DMSTAG.dbo.TEMP_AKAUN_MARA.STUDENTN = [SMBM_DBPELJ].[DBPELJ].[MSTUMASTER].STUDENT
错误
Msg 102,Level 15,State 1,Line 6
')'附近的语法不正确。
答案 0 :(得分:0)
UPDATE DMSTAG.dbo.TEMP_AKAUN_MARA
SET DMSTAG.dbo.TEMP_AKAUN_MARA.[new_BantuanKewangan] =
(CASE
WHEN [SMBM_DBPELJ].[DBPELJ].[MSTUMASTER].[STU_TYPC] = '00' THEN 'Yes'
WHEN [SMBM_DBPELJ].[DBPELJ].[MSTUMASTER].[STU_TYPC] = '01' then 'No')
FROM [SMBM_DBPELJ].[DBPELJ].[MSTUMASTER]
WHERE DMSTAG.dbo.TEMP_AKAUN_MARA.STUDENTN = [SMBM_DBPELJ].[DBPELJ].[MSTUMASTER].STUDENT