Reputation: 21726
I use SQL Server.
There are 2 databases, old
and the new
one.
Databases relational structures are exactly the same.
The difference is:
The question is to find the way to import data from old database to a new one.
Upvotes: 1
Views: 631
Reputation: 2543
you can write a select into query, but consider eric's method first. I'm only adding this as an alternative.
USE AdventureWorks2008R2;
GO
SELECT c.FirstName, c.LastName, e.JobTitle, a.AddressLine1, a.City,
sp.Name AS [State/Province], a.PostalCode
INTO dbo.EmployeeAddresses
FROM Person.Person AS c
JOIN HumanResources.Employee AS e
ON e.BusinessEntityID = c.BusinessEntityID
JOIN Person.BusinessEntityAddress AS bea
ON e.BusinessEntityID = bea.BusinessEntityID
JOIN Person.Address AS a
ON bea.AddressID = a.AddressID
JOIN Person.StateProvince as sp
ON sp.StateProvinceID = a.StateProvinceID;
GO
reference: msdn
with "as" statements you would need to write the column names of the destination, so that the columns match.
Upvotes: 0