Help with Informix/SQL - Novice warning!
Posted in 1994
Topics: Server Administration
****Novice warning**** I am pretty new to Informix and SQL...so apologies if this is not appropriate for the list.... ***** We are in the process of converting to an Informix-based application and would like to 'mass-load' a field in a table based on information from another system. We have looked at two methods: 1 - build the script from the old file which has an SQL line for each line of data which looks it up the record in informix and updates it, 2 - build an informix table from the old data and then have a small script which matches the two and updates the matched records. We tested and would like to use option 2. What we did not accomplish is option 2 using two fields to identify the unique record. For example: The table in the application in which we are moving to looks kind of like... org char(16) account char(8) bud1 decimal(12,2) not null bud2 decimal(12,2) not null : : The table we build from the old data looks like... org char(16) account char(8) bud1 decimal(12,2) not null The script (in DBACCESS) we have been trying to use looks like... update table1 set bud1 = (select bud1 from table2 where table1.org=table2.org and table1.account=table2.account) where org in (select org from table2 where table1.org=table2.org) and account in (select account from table2 where table1.account=table2.account); The error we recieve is something about not being able to set a null to table1.bud1, which to me is saying the first select is not working. I extracted the select from this script, added table1 to the list of tables, and the select does work. Note: If the identifier between the tables was unique by a single field, say 'org', the following script does update the fields appropriately. update table1 set bud1 = (select bud1 from table2 where table1.org=table2.org) where org in (select org from table2 where table1.org=table2.org); Really appreciate the help...Thanks...please send E-mail John Pritchard Catalyst Solutions pritchj@ins.infonet.net 712-258-2771