
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'dbo.[GetOwnDepLink]') AND xtype in (N'FN', N'IF', N'TF'))
DROP FUNCTION dbo.[GetOwnDepLink]

GO

/*
c Кейсистемс (Keysystems), 2005
*/
CREATE   FUNCTION [GetOwnDepLink]()
RETURNS int
AS
BEGIN
RETURN (SELECT TOP 1 LINK FROM dbo.DEPARTMENTS WHERE TYPE = 4)
END



GO


GRANT EXECUTE ON dbo.[GetOwnDepLink] TO PUBLIC

GO

