Environment: SQL Server 2008 / SQL Server 2012
Problem description: How to update tblA with records from tblB (see below expected results) when they have common column DrawingNo?
tblA (#tmpTestTblStage2)
DrawingNo |
PartNo |
TestName |
Description |
M-9500 |
123 |
||
M-9500 |
125 |
||
M-9500 |
127 |
tblB (testTblSP)
DrawingNo |
TestName |
Description |
M-9500 |
tn1 |
dsc1 |
M-9500 |
tn2 |
dsc2 |
M-9500 |
tn3 |
dsc3 |
M-9500 |
tn4 |
dsc4 |
Expected results:
tblA (#tmpTestTblStage2)
DrawingNo |
PartNo |
TestName |
Description |
M-9500 |
123 |
tn1 |
dsc1 |
M-9500 |
123 |
tn2 |
dsc2 |
M-9500 |
123 |
tn3 |
dsc3 |
M-9500 |
123 |
tn4 |
dsc4 |
M-9500 |
125 |
tn1 |
dsc1 |
M-9500 |
125 |
tn2 |
dsc2 |
M-9500 |
125 |
tn3 |
dsc3 |
M-9500 |
125 |
tn4 |
dsc4 |
M-9500 |
127 |
tn1 |
dsc1 |
M-9500 |
127 |
tn2 |
dsc2 |
M-9500 |
127 |
tn3 |
dsc3 |
M-9500 |
127 |
tn4 |
dsc4 |