Subject Re: [firebird-support] Is this possible in SQL?
Author Joe Martinez
Ok, thanks. I was hoping to find a solution NOT using a SP. We really
like to NOT mess with our users' metadata at all. Thanks, though. If
there is a solution that doesn't rely on a SP, I'd love to hear it.

Thanks,
Joe

>You may try it via a stored procedure - something like the following:
>-----
>SET TERM ^ ;
>CREATE PROCEDURE UpdateCustomer (
> iCustID INTEGER)
>AS
>DECLARE VARIABLE toPush VARCHAR(1000); /* choose the max length yourself */
>DECLARE VARIABLE TMP VARCHAR(10); /* must be the same type as Sales.FieldA */
>begin
> toPush='';
> for select FieldA from Sales
> where Custid = :iCustID /* probably order by... */ into :tmp do
> toPush = toPush || tmp || '
>'; /* cancatenate using CRLF; you may need to cast tmp to varchar */
> update Customers set Custnotes = :toPush
> where Custid = :iCustID;
>end^
>SET TERM ; ^
>-----
>
>To update customer notes perform
>-----
>execute procedure UpdateCustomer(<required customer id>);
>-----
>
>
>HTH
>--
>Best regards,
> Pavel Menshchikov
> http://www.ls-software.com
>
>
>
>
>Yahoo! Groups Links
>
>
>
>