SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GOalter function getProductList(@customerguid char(36)) returns varchar(1024) as
begin
declare @product varchar(50)
declare @ReturnListProduct varchar(1024)
declare @ReturnListProductTemp varchar(300)
declare @fuhao char(1)
declare Product_list cursor for select p.productdesc from customer_surrogate cs left join product p on cs.productid = p.product_id
where cs.customer_guid = @customerguid open Product_list;
--+ltrim(rtrim(@Currkey))+('''')
begin
while(1=1)
begin
fetch Product_list into @product
if @@fetch_status=-1
break
else
begin
select @ReturnListProductTemp=@ReturnListProduct
select @ReturnListProduct=ltrim(rtrim(@product))+','+@ReturnListProductTemp
end
end
end
close Product_list
return @ReturnListProduct
endGO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
GO
SET ANSI_NULLS ON
GOalter function getProductList(@customerguid char(36)) returns varchar(1024) as
begin
declare @product varchar(50)
declare @ReturnListProduct varchar(1024)
declare @ReturnListProductTemp varchar(300)
declare @fuhao char(1)
declare Product_list cursor for select p.productdesc from customer_surrogate cs left join product p on cs.productid = p.product_id
where cs.customer_guid = @customerguid open Product_list;
--+ltrim(rtrim(@Currkey))+('''')
begin
while(1=1)
begin
fetch Product_list into @product
if @@fetch_status=-1
break
else
begin
select @ReturnListProductTemp=@ReturnListProduct
select @ReturnListProduct=ltrim(rtrim(@product))+','+@ReturnListProductTemp
end
end
end
close Product_list
return @ReturnListProduct
endGO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
open Product_list;
--+ltrim(rtrim(@Currkey))+('''')
begin
while(1=1)
begin
fetch next Product_list into @product
if @@fetch_status=-1
break
else
begin
select @ReturnListProductTemp=@ReturnListProduct
select @ReturnListProduct=ltrim(rtrim(@product) +','+@ReturnListProductTemp
end
fetch next Product_list into @product --这里少了这句,不然while是个死循环
end
end
close Product_list