RE: INSERT with NOT IN Subquery??
Posted in 1997
Topics: Performance & Tuning, SQL Development & Query Writing
the sub select is very hard for the dbms,
you must be :
1.-
ifExist = 0;
select count(*) into ifExist from employees where EmployeId = 100;2.-
if ifExist = 0 then insert;
any other way is of bad performance...
regards..
MCA
----------
} De: ericesau@dimensional.com
} A: informix-list@rmy.emory.edu
} Asunto: [Q]: INSERT with NOT IN Subquery??
} Fecha: Tuesday 28 de October de 1997 01:12
}
} I am trying to speed up a MS-Access application which is using
} Informix-CLI to access the mainframe database. I am trying to figure out
} how I can insert a row into a table ONLY if it doesn't already exist. I
} am trying to use SQL pass-through queries exclusively. The following are
} two statements I have tried that do not work:
}
} INSERT INTO employees (EmployeeID) VALUES (100) WHERE NOT EXISTS
} (SELECT * from employees WHERE EmployeeID = 100)
}
} INSERT INTO employees (EmployeeID) VALUES (100) WHERE 100 NOT IN
} (SELECT EmployeeID from employees)
}
} Both statements use a where clause which seems to cause the query not to
} work. Any help would be appreciated. I'm a Access programmer not a SQL
} programmer.
}
} Thanks
}
} -------------------==== Posted via Deja News ====-----------------------
} http://www.dejanews.com/ Search, Read, Post to Usenet