DROP FUNCTION IF EXISTS dbo.fnGetEnvironmentName
GO

CREATE FUNCTION dbo.fnGetEnvironmentName()
  RETURNS nvarchar(50)
BEGIN  
  DECLARE @value nvarchar(50)

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