Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 update taking long time..

Author  Topic 

hai
Yak Posting Veteran

84 Posts

Posted - 2007-05-30 : 11:05:28
Can this be re-written using inner join in the following part?
col3 in (select col1 from table2 where col2 = '' and compPassQA is null)
from the following update statement?

UPDATE table SET col1 = col1 + '-XXX'
where col2 IS NULL
and col3 in (select col1 from table2
where col2 = '' and compPassQA is null)

thanks

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-05-30 : 11:10:58
Certainly.

Update t1
set Col1 = Col1 + '-XXX'
From Table t1 Join Table2 t2
on t1.col3 = t2.col1
and t2.col2 = '' and t2.compPassQA is null and t1.col2 is NULL




Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

hai
Yak Posting Veteran

84 Posts

Posted - 2007-05-30 : 11:25:00
thank you...

wow...does work faster with inner join. Harsh, can you explain a bit, if you don't mind, why inner join make a different? I'm trying to figure and learn sql stuffs.

thanks
Go to Top of Page
   

- Advertisement -