Subject | Re: [firebird-support] Is this safe |
---|---|
Author | Ivan Prenosil |
Post date | 2005-04-28T06:41:40Z |
> Can I do the followingSQL standard says that all expressions are evaluated first, then assigned.
>
> Update tablename
> Set FieldA = FieldB, FieldB = NULL
>
> and expect FieldA to have the old value from FieldB and FieldB to now be
> Null? Will this have problems with optimization etc?
>
> I suppose what I am really asking is, is the order of entry important?
On the other hand Firebird evaluates assignments from left to right
(but it is not documented, and it can be changed in the future).
It means that with sql-standard-compliant database you could use either of
Set FieldA = FieldB, FieldB = NULL
Set FieldB = NULL, FieldA = FieldB
but with Firebird you can use only
Set FieldA = FieldB, FieldB = NULL
because this would assign NULL to both fields
Set FieldB = NULL, FieldA = FieldB
Ivan
http://www.volny.cz/iprenosil/interbase/