[dba-SQLServer] Is there a better way to do this?

David McAfee davidmcafee at gmail.com
Fri Jan 21 13:59:51 CST 2011


Is there a better way to do this?

IF (@ChangeKey IN(0,1,2,3,4,5,8,9,10,11,12,13))

    BEGIN
       --Do a bunch of stuff here
    END
ELSE IF (@ChangeKey IN(6,7,14,15) AND @NewStart >@OldEnd)
       BEGIN
       --Do a bunch of stuff here
    END
ELSE IF (@ChangeKey IN(6,7,14,15) AND @NewEnd <@OldStart)
       BEGIN
       --Do a bunch of stuff here
    END
ELSE IF (@ChangeKey IN(6,7,14,15) AND @NewStart <@OldStart AND @NewEnd
>@OldEnd)
       BEGIN
       --Do a bunch of stuff here
    END


More information about the dba-SQLServer mailing list