• Anandkumar-SQL_Developer (9/16/2016)


    Solution :

    select [KPI ID]

    ,[KPI Name],

    [KPIFormula] = case when [kpi id] = 'SA2' then '[QW1]+[SA2]+[BG7]'

    when [kpi id] = 'XS3' then '[QW1]+[BG7]'

    when [kpi id] = 'BG7' then 'BG7' else [kpi id]end

    from #kpi

    ...and if there are thousands (or millions) of KPI's???

    I'm pretty sure I'd rather slit my own wrists than manually rewrite every formula.