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 |
|
goligol
Posting Yak Master
128 Posts |
Posted - 2011-04-29 : 11:18:42
|
| Hi,I have a origin coulumn in one table and destination column in another table. They are saved in different format I would like to map them in the case that I have the same format for both of them as the originis and destinations nodes are same.My destination is in the following format:geo_dest geo_dest_description001 Total010 Alabama011 Birmingham-Hoover-Cullman, AL CSA012 Mobile-Daphne-Fairhope, AL CSA160 Idaho170 Illinois171 Chicago-Naperville-Michigan City, IL-IN-WI CSA (IL Part)172 St. Louis-St. Charles-Farmington, MO-IL CSA (IL Part)181 Chicago-Naperville-Michigan City, IL-IN-WI CSA (IN Part)....and origins:geo_orig geo_orig_description01000US Total04000US01 Alabama04000US02 Alaska04000US04 Arizona04000US05 Arkansas04000US26 Michigan04000US27 Minnesota04000US28 Mississippi04000US29 Missouri04000US30 Montana04000US31 Nebraska04000US32 Nevada04000US33 New Hampshire04000US34 New Jersey04000US35 New Mexico04000US36 New York04000US37 North Carolina04000US38 North Dakota04000US39 Ohio04000US40 Oklahoma04000US41 Oregon04000US42 Pennsylvania04000US44 Rhode Island04000US45 South Carolina04000US46 South Dakota04000US47 Tennessee04000US48 Texas04000US49 Utah04000US50 Vermont04000US51 Virginia04000US53 Washington04000US54 West Virginia04000US55 Wisconsin04000US56 Wyoming04000US60 American Samoa04000US66 GuamE3300US1717600000 Chicago-Naperville-Michigan City, IL-IN-WI E3300US1747600000 St. Louis-St. Charles-Farmington, MO-IL CFS for example geo_dest "001" is "01000US" and "171" represents "E3300US1717600000",My questions are: 1-how to map geo_dest to be consistent with geo_orig in terms of format2- in the following table that I am having how can I map the right ori_dest with the one I have created from the result of first question:geo_dest geo_orig val010 E3300US0999999999 3010 E3300US1154847900 2010 E3300US1242200000 418010 E3300US1299927260 1378010 E3300US1299933100 709010 E3300US1299945300 626011 04000US21 761011 04000US22 522011 04000US23 14011 04000US24 407012 04000US02 NULL012 04000US04 39012 04000US05 171012 04000US06 1118019 04000US18 3194019 04000US19 766019 04000US20 423019 04000US21 2120020 04000US39 353020 04000US40 29020 04000US41 893020 04000US42 170020 E3300US0940800000 8040 04000US11 2040 04000US12 2034040 04000US13 1475040 04000US15 10041 04000US26 1959041 04000US27 1850041 04000US28 444041 04000US44 108 |
|
|
Rosembm1
Starting Member
15 Posts |
Posted - 2011-05-03 : 12:12:36
|
| Hi,I will humbly yield to the SQL programmers with more expertise than I but I have encountered this before. Here is the approach: When you join the tables use functions with the ON for 010 use the cast left and substring functions characters you want to join the linking fields.MWRosenblattSpins Yak |
 |
|
|
goligol
Posting Yak Master
128 Posts |
Posted - 2011-05-03 : 14:54:49
|
| Thank you |
 |
|
|
Rosembm1
Starting Member
15 Posts |
Posted - 2011-05-06 : 08:22:10
|
| Did you get it to work?MWRosenblattSpins Yak |
 |
|
|
|
|
|