Created
July 2, 2014 14:43
-
-
Save kdarty/ad53daae1c4a797a97b9 to your computer and use it in GitHub Desktop.
Constants in SQL Server
This file contains hidden or 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
--Constants in SQL Server | |
--Since SQL Server and T-SQL doesn't support the concept of | |
--Constants, this is one example of how to mimic the functionality. | |
--Source: http://stackoverflow.com/questions/26652/is-there-a-way-to-make-a-tsql-variable-constant | |
CREATE FUNCTION fnConstant() | |
RETURNS INT | |
AS | |
BEGIN | |
RETURN 2 | |
END | |
GO | |
SELECT dbo.fnConstant() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment