Re: Aggregate functions
From: Nigel Rivett (sqlnr_at_hotmail.com)
Date: 06/28/04
- Next message: Aaron [SQL Server MVP]: "Re: Stored Procedure Array Parameter"
- Previous message: George Hester: "Re: I wonder if these ADO constants really work at all"
- In reply to: Steve Kass: "Re: Aggregate functions"
- Next in thread: Steve Kass: "Re: Aggregate functions"
- Reply: Steve Kass: "Re: Aggregate functions"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 27 Jun 2004 17:15:01 -0700
Think it's documented in a white paper somewhere - I've lost the reference now.
Should be
declare @w varchar(100)
select @w=coalesce(@w+',','') +t from w where id=@id
return @w
"Steve Kass" wrote:
> Uri,
>
> While this works in many situations, it's not supported or documented,
> and I don't recommend using it in a production environment.
>
> SK
>
> Uri Dimant wrote:
>
> >impafait
> >You dont have to know a maximum number of items
> >Look at below soultion works for you
> >create table w
> >(
> > id int,
> > t varchar(50)
> >)
> >
> >insert into w values (1,'abc')
> >insert into w values (1,'def')
> >insert into w values (1,'ghi')
> >insert into w values (2,'ABC')
> >insert into w values (2,'DEF')
> >select * from w
> >
> >
> >create function dbo.fn_my ( @id int)
> >returns varchar(100)
> >as
> >begin
> >declare @w varchar(100)
> > set @w=''
> > select @w=@w+t+',' from w where id=@id
> > return @w
> >end
> >
> >select id,
> >dbo.fn_my (dd.id)
> >from
> >(
> > select distinct id from w
> >)
> >as dd
> >
> >drop function dbo.fn_my
> >"imparfait" <imparfait@noway.noway> wrote in message
> >news:%23ZsOuM6WEHA.3640@TK2MSFTNGP11.phx.gbl...
> >
> >
> >>Thank you very much for ur precise and detailed answer.
> >>
> >>
> >>"Steve Kass" <skass@drew.edu> a écrit dans le message de
> >>news:eH6Yxx5WEHA.2520@TK2MSFTNGP12.phx.gbl...
> >>
> >>
> >>>There is no feature of SQL Server specifically for this requirement,
> >>>though user-defined aggregates may be available in SQL Server 2005.
> >>>
> >>>
> >>
> >>
> >
> >
> >
> >
>
>
- Next message: Aaron [SQL Server MVP]: "Re: Stored Procedure Array Parameter"
- Previous message: George Hester: "Re: I wonder if these ADO constants really work at all"
- In reply to: Steve Kass: "Re: Aggregate functions"
- Next in thread: Steve Kass: "Re: Aggregate functions"
- Reply: Steve Kass: "Re: Aggregate functions"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|