Reputation: 65870
I have a requirement like this.
Step 1 : I need to retrieve the Access db's data into sql server database.I have done that by using SSMS's Import wizard tool.I have given that database name as LegacyData
Step 2 : I need to insert this Legacy data into new Sql server database called AppData
.
Note : The names of the tables and the column names are different on 2 databases.
As an e.g. On the LegacyData
database has a table name Homeowner Foreclosures
.The mapping table's name of the AppData
database is Properties
.
Columns are like this :
Homeowner Foreclosures
: PLID,Deeddate,County
Properties
: Id,DeedDate,CountyId
Note : Here County
is the Name
of the Counties
Master table and CountyId
is the Id
of Counties
table.I have to do a mapping here also.
Counties
: Id,Name
Can you tell me how to do this kind of data migration process ?
Upvotes: 0
Views: 126
Reputation: 3993
I think this is what you are looking for.
Use AppData
Insert Properties
Select H.PLID, H.DeedDate, C.CountyID
From LegacyData.dbo.HomeownerForclosure H
Join LegacyData.dbo.Counties C On H.County = C.Name
Upvotes: 1