create table cs1(id int,amount int)
insert into cs1 select 1,40
union all select 1,80
union all select 2,10
union all select 2,20
union all select 3,60
CREATE FUNCTION dbo.f_str(@id varchar(100))
RETURNS varchar(1000) AS
BEGIN
declare @s varchar(4000)
set @s=''
select @s=@s+'/'+ltrim(amount) from cs1 where id=@id
if @s<>''
set @s=stuff(@s,1,1,'')
return @s
END
select id,dbo.f_str(id) amount from cs1 group by id