Re: INSERT with NOT IN Subquery??
Posted in 1997
Topics: SQL Development & Query Writing
Seems to me you would be better off checking for the existance of said record prior to trying to insert. In fact, as far as I know (which isn't necessarily very far) there is no "where" clause in an "insert" statement. }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 }