Re: Aggregate functions

From: Nigel Rivett (sqlnr_at_hotmail.com)
Date: 06/28/04


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.
> >>>
> >>>
> >>
> >>
> >
> >
> >
> >
>
>



Relevant Pages

  • Re: New to Perl: Need help with a script
    ... It might take some getting used to (you'll need to declare your variables, ... >sub usage() { ... You might want to use a here-doc (perldoc perldata) instead, ... pointing to the same array reference. ...
    (comp.lang.perl.misc)
  • Re: Excel Automation
    ... Declare a conditional compilation constant at the start of your module: ... #If EarlyBinding Then ... Dim xlApp As Excel.Application ... When you are ready to distribute the app, remove the reference, change the ...
    (microsoft.public.access.formscoding)
  • Re: Question about OO programming in Ada
    ... when I declare a procedure ... Both the Ada Rationale and the Guide for C/C++ programmers say that you have ... The Ada 95 Reference says that the "all" attribute provides read-write ... Does that help to avoid casting as well? ...
    (comp.lang.ada)
  • Re: Public variable not seen by all controls on a Page
    ... User Control, so you must reference it through the User Control. ... Also note that you have the property declared as "quickAdd" but you are ... Is there a place in the page where I can declare a variable (maybe ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: CreateObject("Word.Application") fails though Word session starts
    ... I absolutely agree that 1004 isn't a useful error code -- but it's ... The 'objWordApp' object is declared with a "Public Const gobjWordApp ... The idea of a missing reference is interesting. ... How did you declare gobjWordApp? ...
    (microsoft.public.excel.programming)