create function [dbo].[GetOperateCustGroup] ( @CustomerGuid varchar(36), @StrategyOperateId varchar(36) ) returns @TempTable table (MaxPrice float,MinPrice float,[Percent] float) AS begin declare @CustomerGroupId int select @CustomerGroupId = CustomerGroupId from T_CustGroupMember where CustomerGuid = @CustomerGuid set @CustomerGroupId=isnull(@CustomerGroupId,0) insert into @TempTable select MaxPrice,MinPrice,[Percent] from VC_T_StrategyOperateCustGroup where CustomerGroupId = @CustomerGroupId and StrategyOperateId=@StrategyOperateId return end 调用方式 SELECT * FROM [GetOperateCustGroup] ('12','22')