473,890 Members | 1,716 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

The ultimate migration nightmare - need help

I have to migrate data from one database table to another table in
another database where the fields do not match, not even in the same
order, and even if they do match, on occasions the datatypes are
completely different (varchar vs int, varchar vs char, int vs datetime,
etc.).

I am expected to do this immediately so this is an emergency request.

Help!

Thanx
Phil

Jan 23 '06 #1
2 1496
<ph************ **@gmail.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
I have to migrate data from one database table to another table in
another database
You can move data from one database to another with syntax such as:

INSERT INTO database2.table 2 (field1, field2, field3)
SELECT expr1, expr2, expr3 FROM database1.table 1 WHERE blah blah blah

Note the database.table notation. You can specify the databases where each
table lives with this syntax, and thus move values from a table in one
database to a table in a different database.
where the fields do not match, not even in the same order,
Explicitly naming the fields in the destination table allows you to map the
fields of the select-list to fields of the destination table. And you can
use expressions in the select-list instead of plain field names, so you can
manipulate the values appropriately to fit into the datatypes of the
destination.
and even if they do match, on occasions the datatypes are
completely different (varchar vs int, varchar vs char, int vs datetime,
etc.).
Well, there are ways to convert from one datatype to another in most cases.
Though sometimes there might be some information lost.

For instance, if a varchar contains the string '123ABC' and its destination
is an integer field, you can convert the string to its initial integer part
with expressions such as: SELECT CAST('123ABC' AS UNSIGNED) or SELECT
FLOOR('123ABC') . This yields the integer '123', but loses the 'ABC' part.

Or you could use the HEX() function to create a reversible integer
representation of the whole string. It's not clear from your description
what is the nature of the data in these fields, so it's not possible to give
a recommendation that will work in all cases.

You also mention converting an integer to a datetime. How is this done? An
integer can be used to represent datetime information in many ways. Number
of seconds since 1/1/1970 12:00:00 is one standard way. Is that what the
integer in your database represents? (hint: the FROM_UNIXTIME() function
outputs a human-readable format for the data, based on an integer in this
format)

Read the following pages for more documentation on MySQL functions that may
help:
http://dev.mysql.com/doc/refman/5.0/...functions.html
http://dev.mysql.com/doc/refman/5.0/...functions.html
http://dev.mysql.com/doc/refman/5.0/...functions.html
http://dev.mysql.com/doc/refman/5.0/...functions.html

Basically, your task is to make policy decisions about how the data in these
fields map into the destination database. Sometimes there may be
unavoidable loss of information, unless you can also modify the schema of
the destination database.

Once you have the data mapping decisions made, it's more straightforward to
make expressions to convert the values to something that is compatible with
the datatypes of the destination fields.
I am expected to do this immediately so this is an emergency request.


It is unreasonable to expect this task to take *zero* time.

Regards,
Bill K.
Jan 23 '06 #2
"It is unreasonable to expect this task to take "zero" time."

Unreasonable yes. Did that ever stop the government before?

Phil

Jan 25 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
20007
by: susmita_ganguly | last post by:
Hi I am trying to upgrade from oracle 8i to oracle 9i on the same server ..I don't know much abt migration . Can anyone help me out. Thanks. Susmita
4
3995
by: Abram Friesen | last post by:
Hi, I'm a developer for a software application vendor, and our application makes use of a customer-maintained Oracle 8i/9i database. We've had a customer request to support DB2 database, and I'm looking into the feasibility of migration. Our application runs on NT Server and, the DB2 database would be in some cases on a separate AIX machine, in other cases on an AS/400. There are two problems we are running into, both relating to our...
2
1912
by: aww91 | last post by:
Company is planning a Sybase to UDB migration that is projected to take 1 year. During that long period of time any Code Freeze put into place would impact our users (we normally release code changes once a month). Any suggestions on how to manage a partial code freeze while under going a major migration like this one?
8
712
by: Scott | last post by:
I have written windows applications using MFC for several years and have frequently used MFC techniques. Now I'm moving to C# .NET WinForm. Mostly C# books describes C# language (sometimes compared with C++) and then how to use Windows Forms but without comparison with MFC. Would you recommend any book or online stuff to guide migration from MFC/Win32 to Windows Forms to save time and effort to learn new environment. I realized that...
1
2074
by: pankaj_wolfhunter | last post by:
Greeting, Can anyone tell me the points to keep in mind while migrating data from Sybase to DB2 especially in case of LOB data. I know the books available on the IBM site, but if still someone can provide me their own specific points? Any help will be appreciated. TIA
60
4968
by: Shawnk | last post by:
Some Sr. colleges and I have had an on going discussion relative to when and if C# will ever support 'true' multiple inheritance. Relevant to this, I wanted to query the C# community (the 'target' programming community herein) to get some community input and verify (or not) the following two statements. Few programmers (3 to7%) UNDERSTAND 'Strategic Functional Migration
9
4209
by: Troels Arvin | last post by:
At work, some people have found IBM's Migration Toolkit (MTK) to be a nice tool for copying data from one table (in another DBMS product) to DB2. Now, they want to do the same thing from one DB2 database to another DB2 database. - But MTK (surprisingly) doesn't seem to support DB2-DB2 copies. These are non-regular, ad-hoc tasks, performed by users without administrative rights (and generally somewhat annoyed by command line...
2
2407
by: =?Utf-8?B?TG9yZW4=?= | last post by:
I have a brand new Dell computer right out of the box. It was purchased with Windows Vista Basic. I have also separately purchased Windows Vista Ultimate and I want to install it on this new computer. What is the best approach to accomplish this task? Should I start up the new Dell computer and have it go through its Windows Vista Basic setup then upgrade to Vista Ultimate? Or should I start by inserting the Windows Vista Ultimate...
3
4651
Frinavale
by: Frinavale | last post by:
I have been researching the best approach to migrating a VB6 application into a VB.NET application. There is a lot of information out there but most of it recommends that you "train in the migration process before jumping into it". One site even recommends that this training process should take at least 2-3 weeks. I'm not sure how you can train for such a process...but maybe I'll find something while I'm researching. I was wondering if anyone...
0
9815
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11215
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10451
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9618
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8008
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7160
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6035
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4665
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4259
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.