Skip to content

Instantly share code, notes, and snippets.

@erikdarlingdata
Created November 29, 2022 19:23
Show Gist options
  • Save erikdarlingdata/a74996099ff9bbef9c5171c2df78f9b3 to your computer and use it in GitHub Desktop.
Save erikdarlingdata/a74996099ff9bbef9c5171c2df78f9b3 to your computer and use it in GitHub Desktop.
DECLARE
@a bit = 0,
@b bit = 0,
@r varchar(5) = '';
/*This was 100x faster*/
IF @b = 0 AND @a = 0
RETURN 'S';
IF @b = 0 AND @a = 1
RETURN 'A';
IF @b = 1 AND @a = 0
RETURN 'B';
RETURN 'AB';
/*Than doing this*/
IF @b = 0 AND @a = 0
SET @r = 'S';
IF @b = 0 AND @a = 1
SET @r = 'A';
IF @b = 1 AND @a = 0
SET @r = 'B';
ELSE
SET @r = 'AB'
RETURN @r;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment