ALTER FUNCTION [dbo].[foo_GetTotalChannelCount] ( @GroupId int ) RETURNS int AS BEGIN return (SELECT COUNT(*) FROM [dbo].[Channels] WHERE GroupId = @GroupId) END