Hallo, kann man diesen Code irgendwie kompakter schreiben?
@C1_ID, etc. sind Parameter vom Typ VARCHAR(50) einer sp.
Code:
DECLARE @Counter INT
SET @Counter = 1
WHILE (@Counter < 5)
BEGIN
IF (@Counter = 1)
BEGIN
SET @C_ID = @C1_ID
END
ELSE IF (@Counter = 2)
BEGIN
SET @C_ID = @C2_ID
END
ELSE IF (@Counter = 3)
BEGIN
SET @C_ID = @C3_ID
END
ELSE IF (@Counter = 4)
BEGIN
SET @C_ID = @C4_ID
END
SET @Counter = @Counter + 1
-- some more code.....
END