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 Statment using Inner Join

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-05-25 : 08:52:00
Ziva writes "Hi,
I'm converting an existing application (vb6) based on MSACCESS database to SQL server with ADO Connection.
I have lot of hard coded SQL sentences which I have to convert to fit to SQL server dialect.
One of the problems is how to convert the next SQL:
"Update table1 Inner Join table2 ON table1.filed1=table2.field1 set table1.field2=x"
I searched the web to find somewhere answers but not successfully.
I will appreciate your response"

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-05-25 : 09:00:11
U might not have searched the BOL
If u did u would have got the answer


Update table1
set table1.field2=x
from table1
Inner Join table2 ON table1.filed1=table2.field1


Srinika
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-05-25 : 09:37:39
quote:
Originally posted by Srinika

U might not have searched the BOL
If u did u would have got the answer


Update table1
set table1.field2=x
from table1
Inner Join table2 ON table1.filed1=table2.field1


Srinika



Always prefix on the right side of the equal to sign

Update table1
set field2=table2.x
from table1
Inner Join table2 ON table1.filed1=table2.field1


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -