I would like to set a variable in SQL Server using a CASE
statement. For example:
DECLARE @UNITY VARCHAR(5)
DECLARE @AUX VARCHAR(5)
CASE
WHEN @UNITY = 'U1' THEN @AUX = 'M1'
WHEN @UNITY = 'U2' THEN @AUX = 'M2'
WHEN @UNITY = 'U3' THEN @AUX = 'M3'
END
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…