CustomersPerTask (funktion)

Returnerar antalet kunder som finns på ett ärende. Denna funktion är kopplad till fältet [CustomerCount] i tabellen [Task].

 

Inparameter: int

Returnerar: nvarchar(5)

 

Script:

 

USE [databasename] GO
/****** Object: UserDefinedFunction [dbo].[CustomersPerTask] Script Date: 2017-05-30 21:24:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
— =============================================
— Author: Per Hultqvist
— Create date: 2017-04-11
— Description: Customers per task
— =============================================
ALTER FUNCTION [dbo].[CustomersPerTask](@taskId int)
RETURNS nvarchar(5)
AS
BEGIN
DECLARE @count int
SELECT @count=COUNT(CustomerId) FROM Customer_Task WHERE TaskId = @TaskId
RETURN @count
END

This entry was posted in Okategoriserade. Bookmark the permalink.