Skip to content

Instantly share code, notes, and snippets.

@kdarty
Created July 2, 2014 14:43
Show Gist options
  • Save kdarty/ad53daae1c4a797a97b9 to your computer and use it in GitHub Desktop.
Save kdarty/ad53daae1c4a797a97b9 to your computer and use it in GitHub Desktop.
Constants in SQL Server
--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