This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE INDEX whatever ON dbo.Users(Reputation); | |
GO | |
ALTER FUNCTION dbo.BeatIt(@Reputation INT) | |
RETURNS TABLE | |
AS | |
RETURN | |
SELECT * | |
FROM dbo.Users AS u | |
WHERE u.Reputation = @Reputation; | |
GO | |
ALTER PROCEDURE dbo.BeatThat(@Reputation INT) | |
AS | |
SET NOCOUNT, XACT_ABORT ON; | |
BEGIN | |
DECLARE @ReputationFix INT; | |
SET @ReputationFix = @Reputation; | |
IF @ReputationFix NOT BETWEEN 1 AND 2000000 | |
BEGIN | |
SET @ReputationFix = 1; | |
END | |
SELECT * | |
FROM dbo.BeatIt(@ReputationFix) AS bi; | |
END; | |
EXEC dbo.BeatThat @Reputation = 1; | |
EXEC dbo.BeatThat @Reputation = 2; | |
DBCC FREEPROCCACHE; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment