Created
July 6, 2020 18:19
-
-
Save BrentOzar/ec93d1d3bab8cc046d80d8b71ec6442a to your computer and use it in GitHub Desktop.
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
ALTER DATABASE CURRENT SET COMPATIBILITY_LEVEL = 140; | |
GO | |
CREATE OR ALTER FUNCTION dbo.Test() | |
RETURNS INT AS | |
BEGIN | |
DECLARE @i BIGINT; | |
SELECT TOP 1 @i = CHECKSUM(*) | |
FROM master.dbo.spt_values; | |
RETURN 1; | |
END | |
GO | |
SELECT dbo.Test(); /* Works fine */ | |
ALTER DATABASE CURRENT SET COMPATIBILITY_LEVEL = 150; | |
GO | |
SELECT dbo.Test(); | |
/* Gets error: | |
Msg 1789, Level 16, State 1, Procedure Test, Line 6 [Batch Start Line 17] | |
Cannot use CHECKSUM(*) in a computed column, constraint, default definition, or INSERT statement. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment