DROP FUNCTION IF EXISTS dbo.fnGetEnvironmentName
GO

CREATE FUNCTION dbo.fnGetEnvironmentName(
    @key nvarchar(200) = NULL)
  RETURNS nvarchar(50)
BEGIN  
  DECLARE @value nvarchar(50)

  SELECT @value = [Value]
  FROM dev.EnvironmentInfo e
  WHERE [Key] = ISNULL(@key,'Kornyezet')
  
  RETURN @value  
END;
GO