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 in a store procedure

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-07-13 : 09:27:15
cindy writes "hi,

i have two tables T1,T2:

T1 include fields like:
productcode,a,b,c,d

T2 include fields like:
productcode,a,b (field names are same as those in T1)

what i want to do in a store procedure is :

update all records in T1 using data from T2 when the a and b in T1 are both null according to the productcode

thanks"

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-07-13 : 09:32:41
May be this is what u are looking for...

update t1
set ...
from t1 join t2 on t1.productcode = t2.productcode
where t1.a is NULL and t1.b is NULL


Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page
   

- Advertisement -