July 28, 2012 at 6:22 am
hi
We need to combine two DML Statement into one statment
update B
Set B.phone_disp_new = ISNULL(A.value,'Other')
from test22 B
left outer join test21 A
on B.ph_phone_new = A.TGA_CODE
update B
Set B.phone_disp_old = ISNULL(A.value,'Other')
from test22 B
left outer join test21 A
on B.ph_phone_old = A.TGA_CODE
Can we do it in one update statement?
July 28, 2012 at 6:46 am
Please post sample data. Will get back to you.
~ Lokesh Vij
Link to my Blog Post --> www.SQLPathy.com[/url]
Follow me @Twitter
July 28, 2012 at 12:20 pm
harrd007 (7/28/2012)
hiWe need to combine two DML Statement into one statment
update B
Set B.phone_disp_new = ISNULL(A.value,'Other')
from test22 B
left outer join test21 A
on B.ph_phone_new = A.TGA_CODE
update B
Set B.phone_disp_old = ISNULL(A.value,'Other')
from test22 B
left outer join test21 A
on B.ph_phone_old = A.TGA_CODE
Can we do it in one update statement?
Is this what you want?
update B
set
B.phone_disp_new = ISNULL(A.value,'Other'),
C.phone_disp_old = ISNULL(B.value,'Other')
from
test22 B left outer join test21 A
on B.ph_phone_new = A.TGA_CODE
left outer join test21 C
on C.ph_phone_old = A.TGA_CODE
Tom
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply