Select ID,
case
when (Left <>0 and Right <>0) or (Left =0 and Right =0) then Amount
when Left = 0 then Amount + 'R' + Right
when Right = 0 then Amount + 'L' + Left
end
转换字符的错误应该是由于类似 Amount + 'R' + Right 的运算. 可以试试 cast(Amount as varchar) + 'R' + cast(Right as varchar)