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.
| Author |
Topic |
|
testac
Starting Member
3 Posts |
Posted - 2009-10-18 : 14:10:37
|
| I have 3 Table say TableA(holding data) ,TableB(mapping data) and TableC(data to be inserted).TableA Col1 ---- High High Low Right Low Left TableB Col1 Col2 ----------------- 1 High 2 Low 3 Left 4 Right Table Col1 ---- 1 1 2 4 2 3My Dataset is like 3 tables shown above.TableA consists of source data uploaded using bcp.TableB is a mapping table with static reference values as you can see.TableC is the table to which now data has to be inserted which is col1 of TableB and equivalent numeric value for Col1 in TableA.So my doubt is how I write so that I write my insert script for TableCand resolve corresponding values for Col1 in TableA.in short I want numeric equivalent of Col1 in TableA to be inserted into TableC by checking on mapping values rom TableB.Thanks in advance |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-10-18 : 14:20:35
|
Try this:insert tableCselecttableB.col1from tableAjoin tableB on tableB.Col2 = tableA.Col1 No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|