有没有一种方法可以在 SQL Scalar 函数中用一个变量返回 2 个值
ALTER FUNCTION [report].[fGetKPI] (@metricName AS VARCHAR(50))
RETURNS SMALLINT
AS
BEGIN
DECLARE
@kipId AS SMALLINT,
@metricId as SMALLINT;
SELECT TOP 1 @kipId = [KPI_Id], @metricId = [MetricId] FROM report.[KPIDetails] WHERE [MetricName] = @metricName;
IF (@kipId IS NULL OR @metricId IS NULL)
DECLARE @Error AS INT = dbo.fThrowError('No key found for the component "' + @metricName + '"');
RETURN (select @kipId,@metricId);
END