kdarty
7/2/2014 - 2:43 PM

Constants in SQL Server

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()