Subject RE: [ib-support] Oooops i mean Exchange values between Fields in one Update
Author Alan McDonald
not much good for strings though
BTW - why would you want to swap values in columns?

> -----Original Message-----
> From: Milan Babuskov [mailto:albis@...]
> Sent: Tuesday, 27 May 2003 12:47 AM
> To: ib-support@yahoogroups.com
> Subject: Re: [ib-support] Oooops i mean Exchange values between Fields
> in one Update
>
>
> Alan McDonald wrote:
> > maybe
> > update table set field1=field2, field2=field1
> > works?
>
> Nope. But the old +/- trick does:
>
> SQL> create table test (a int, b int);
> SQL> insert into test values (1,2);
> SQL> select * from test;
>
> A B
> ============ ============
>
> 1 2
>
> SQL> update test set a = a + b, b = a - b, a = a -b;
> SQL> select * from test;
>
> A B
> ============ ============
>
> 2 1
>
> By preserving b's value in a, you can retrieve it later.
>
> --
> Milan Babuskov
> http://fbexport.sourceforge.net
>
>
>
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>