Q:

SQL Server - Populate Relationship Table based on values from two different tables

I have a large data-set that contains many columns, one of which is a US State.  I have then created a table to contain only the US States and then I created a relationship table for the large data-set and the US States table. 
I'm finding it quite difficult to populate the relationship table.  Logically, I want to have a match of the State Name from the large data-set and the State Name from the US States table, if there is a match populate the relationship table with the Id from the large data-set and the Id from the US States table. 
US States Table:
Id   State Name    
1    New York
2    Alabama
3    Idaho

Large Data-Set:
Id   Person   States
1    Sam      Idaho
2    John     New York
3    Karen    Alabama

Relationship Table should be:
Id   Person ID   State Id
1    1           3
2    2           1
3    3           2

This appears to be simple at first glance, but due to my lack knowledge in SQL, I'm finding it quite difficult to populate the relationship table.  
If it's not clear, please do ask and I will amend.  Thanks for the help! 

A:

Something along the next lines:
insert into reltable(id_largetable, id_statestable)
select lt.id, st.id
from largetable lt inner join statestable st on st.statename = lt.statename

