Posted in 2005
Topics: SQL Development & Query Writing
i try to do the following:
insert into table select * from temp_table where name='BoB' and not
exists (select * from table where name='BoB');
this always gives me back the error:
SQL Error (-360): Cannot modify table or view used in subquery..
what do i do??
all I want is a condition so that i won't insert the same row that is
already there..
<pookguy88@gmail.com> wrote:
> i try to do the following:
> insert into table select * from temp_table where name='BoB' and not
> exists (select * from table where name='BoB');>
> this always gives me back the error:
> SQL Error (-360): Cannot modify table or view used in subquery..
>
> what do i do??
> all I want is a condition so that i won't insert the same row that is
> already there..
Would this get you what you want?
INSERT INTO tab1
SELECT * FROM tab2 WHERE name NOT IN (SELECT name FROM tab1);
--
June Hunt
If it does not help.
make two steps:
1. First make a temporary table
2. Insert from this table
pookguy88@gmail.com schrieb:
> i try to do the following:
> insert into table select * from temp_table where name='BoB' and not
> exists (select * from table where name='BoB');>
> this always gives me back the error:
> SQL Error (-360): Cannot modify table or view used in subquery..
>
> what do i do??
> all I want is a condition so that i won't insert the same row that is
> already there..
>
We use strictly necessary cookies to make this site work. With your consent we’d also use optional cookies for analytics and marketing. You can accept all, reject all, or choose. Read our Cookie Policy.