CREATE FUNCTION GetClientName ( @JobId bigint ) RETURNS VARCHAR(MAX) AS BEGIN DECLARE @ClientName AS VARCHAR(MAX) select @ClientName = c1.clientname FROM tbl_client c1 INNER JOIN tbl_mechanicalbrief m ON m.clientid = c1.clientid WHERE mechanicalid = @JobId Union select @ClientName = c2.clientname FROM tbl_iteration i INNER JOIN tbl_client c2 ON i.clientid = c2.clientid WHERE iterationid = @JobId Union select @ClientName = c3.clientname FROM tbl_release r INNER JOIN tbl_client c3 ON r.clientid = c3.clientid WHERE releasingid = @JobId RETURN @ClientName END
Select statements included within a function cannot return data to a client.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)