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 2005 Forums
 Transact-SQL (2005)
 update table

Author  Topic 

eugz
Posting Yak Master

210 Posts

Posted - 2008-02-01 : 12:24:24
Hi All.
I have problem to update table. What is my misstake
update dbo.Table1
set Field1_id = s.Field1_id
select Field3_id, Field4
from dbo.Table1
join dbo.Table2 s
on Field4 = s.Field2

Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-02-01 : 12:29:11
Why are you mixing select with update? take the select away

update t
set t.Field1_id = s.Field1_id
from dbo.Table1 t
join dbo.Table2 s
on Field4 = s.Field2

i cant understand 'select Field3_id, Field4 ' statement though. Are you trying to simultaneously select?You need to give it as a seperate statement then
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-02-01 : 12:29:39
If your intention to return what was updated check out OUTPUT from books online.

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -