0

I want to create the following line into SQL statement:

If account code is XING replace the strategy to GRE?

I have the following which is not working:

/if($_Account Master.Account Code CNS$,/replace($_Account Master.Strategy$,$_Account Master.Strategy$,GRE))

Please let me know the correct method.

4

2 回答 2

3

如果您正在谈论基于变量替换变量中的值,请使用

IF @AcciountCode = 'XING' @Strategy = 'GRE'

但我感觉您需要更新表中的各个字段。如果是这样,你需要类似的东西

UPDATE [Account Master] SET Strategy = 'GRE' WHERE [Account Code] = 'XING'
于 2013-09-23T19:46:29.267 回答
2

这是您在 select 语句中执行此操作的方式:

SELECT CASE WHEN [Account Code] = 'XING' THEN 'GRE' ELSE [Strategy] END AS [Strategy]
FROM [Account Master]
于 2013-09-23T19:45:47.800 回答