关于sql函数返回表,以前没写过,现在做项目中需要,所以就写了一上,保存一下,以备下次用。

 

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')

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-20
  • 2022-01-14
  • 2022-12-23
  • 2021-05-17
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-29
  • 2022-12-23
  • 2022-01-02
  • 2021-11-30
  • 2021-09-28
相关资源
相似解决方案