USE [DataPRO] GO /****** Object: UserDefinedFunction [dbo].[foo_GetTotalChannelCount] Script Date: 4/2/2019 2:40:14 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER FUNCTION [dbo].[foo_GetTotalChannelCount] ( @GroupId int ) RETURNS int AS BEGIN return (SELECT COUNT(*) FROM [dbo].[Channels] WHERE GroupId = @GroupId) END