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 query

Author  Topic 

TheOne
Starting Member

6 Posts

Posted - 2009-05-11 : 05:21:35
Can v update two different columns of different table in single query.

for example:-
update a set a.col_name = 'xyz'
from table1 a ,table b where a.col= b.col and a.some_column= 1
this is correct



update a,b set a.col_name = 'xyz' ,b.col_name = 'abc'
from table1 a ,table b where a.col= b=col and a.some_column= 1

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-05-11 : 05:23:33
Nope. You can't


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-05-11 : 06:13:02
ya possible.. it will work.


Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-05-11 : 06:21:16
quote:
Originally posted by senthil_nagore

ya possible.. it will work.


Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled


It is not possible. You should use two different queries

Madhivanan

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

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-05-11 : 06:46:26
Sorry, I miss interpret it.

Thanks FYI


Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled
Go to Top of Page
   

- Advertisement -