Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Transfer data using SSIS. Convert between int and guid.

Posted on 2007-03-23
4
Medium Priority
?
1,477 Views
Last Modified: 2013-11-30
Hello,

I'm in the process of moving data from one database to another.  Both are Microsoft sql 2005 databases.  I planning on using SSIS to do this but have run into a problem.  Since the source database uses int for its primary key and the destination database uses guid for its primary key how can I preserve relationships between tables.  

I am fairly new to SSIS but feel comfortable with straight forward data transfer between tables.  Any advice/help would be greatly appreciated.

Thanks for the help in advance.
Dean.
0
Comment
Question by:drimando
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 8

Expert Comment

by:navalarya1982
ID: 18785766
can you share the query you are using for data transfer?
0
 

Author Comment

by:drimando
ID: 18786230
Thanks for the response.

I actually don't have a query to share as this is where I need help.  I'm looking for some guidance as to how to go from a database that uses OID to one that uses GUID and still maintain table relationships.  

Example:

Source Database has Customer, Project and Contact Tables with the following fields:
Customer Table: OID, CustomerName, ContactID, ProjectID
Contact Table: OID, ContactName
Project Table: OID, ProjectName

Destination Database has Customer, Project and Contact Tables with the following fields:
Customer Table: GUID, CustomerName, ContactGUID, ProjectGUID
Contact Table: GUID, ContactName
Project Table: GUID, ProjectName

How do you move data between the databases and still maintain the corresponding links to the Contact and Project Tables?

Thanks.
0
 
LVL 8

Accepted Solution

by:
drydenhogg earned 2000 total points
ID: 18792472
I can't think of an easy / automatic way to do it, it is possible although it is going to take some manual work / thinking through the issue.

In the destination database add an integer field to hold the old ID and import the data generating GUID's as you go along where necessary. Then you will need to run updates to rematch the data based on the ID's, when you have processed each table and the ID field, you can alter the table and drop the old ID column.

If the tables form a natural hierarchy you can use the lookup IS object to perform this on the fly instead of doing it manually, however if you have any references which end up being a bit circular then you have to make a decision which table to bring over first, bring the integer ID with it, and then do the rest from there in the right order (reverse up the hierarchy).

hth.
0
 

Author Comment

by:drimando
ID: 18792535
Hi drydenhogg,

I thought of a solution along these lines before posting but wasn't sure if there was an easier way.  I was hoping there would be...

Thanks for your help.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
I have a large data set and a SSIS package. How can I load this file in multi threading?
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question