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
 General SQL Server Forums
 New to SQL Server Programming
 How i can do this query without using cursor.....

Author  Topic 

arorarahul.0688
Posting Yak Master

125 Posts

Posted - 2009-06-09 : 04:50:59
Hi All,

I have two tables
table a
A
Col1 Col2
1 aaaa
2 bbbb
3 cccc
4 dddd
5 eeee
6 ffff
Table b
B
Col1 Col2
4 kkkk
5 llll

i want to run a query to update the Col2 in table A with col2 in table B Where the Col1 in A = Col1 in B

How can i do it without using cursors....
Please give your some time

Thanks,


Rahul Arora
NCCE, Panipat


######################
IMPOSSIBLE = I+M+POSSIBLE

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-06-09 : 04:55:41
don't need cursor


update a
set col2 = b.col2
from tablea a inner join tableb b on a.col1 = b.col1



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

Go to Top of Page

arorarahul.0688
Posting Yak Master

125 Posts

Posted - 2009-06-09 : 05:43:13
quote:
Originally posted by khtan

don't need cursor


update a
set col2 = b.col2
from tablea a inner join tableb b on a.col1 = b.col1



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





Bingo....
thanks a lot

Rahul Arora
NCCE, Panipat


######################
IMPOSSIBLE = I+M+POSSIBLE
Go to Top of Page
   

- Advertisement -