Re: New to informix.
Posted in 1998
Topics: Transactions, Locking & Isolation
Joseph:
To find the tables that columns "switch_id" and "port_number" can be
found, try this:
{Identifies tables containing column "switch_id"}
select a.tabname switch_id_tables
from systables a, syscolumns b
where b.colname = "switch_id"
and a.tabid = b.tabid
into temp t_switch_id with no log;
{Identifies tables containing column "port_number"}
select a.tabname port_number_tables
from systables a, syscolumns b
where b.colname = "port_number"
and a.tabid = b.tabid
into temp t_port_number with no log;
{Identifies tables containing both "switch_id" and "port_number"}
select a.switch_id_tables
from t_switch_id a, t_port_number b
where a.switch_id_tables = b.port_number_tables;
Then, once you identify the table(s) you want to update:
{Beware of long transactions if this will update numerous rows and
transaction logging is enabled.}
update <italic>name_of_the_table
</italic> set port_number = "5061"
where switch_id = "2XO";
Of course, if you have numerous tables to update, you'll probably want to
write a script or program to perform the update. I hope this is what you
need.
-- Richard
At 12:08 6/16/98 GMT, josephatl@mindspring.com wrote:
>Hello everyone. I'm new to informix & isql in general, so this is going
to be
>simple for you.
>
>I need to know how to find the field names in all my tables, and then
how to
>replace the value of a field in one record based on the value of
another
>field. ie...:
>
>replace port_number with "5061" where switch_id = "2XO"
>
>but I don't know how to tell it which table to look in.
>
>Any help would be greatly appreciated.
>
>
>-----== Posted via Deja News, The Leader in Internet Discussion
==-----
>http://www.dejanews.com/ Now offering spam-free web-based
newsreading
>
>
--
Richard Caldera
SKECHERS USA, Inc.
MIS Department
richardc@skechers.com
(310) 318-3100 x 1228