Home arrow MySQL arrow Page 3 - Transferring Data to MySQL Using SQLyog

Getting Started - MySQL

Need any easy way to import data from your ODBC-compliant database into MySQL? Look no further than SQLyog's ODBC Import tool. Read all about it inside.

TABLE OF CONTENTS:
  1. Transferring Data to MySQL Using SQLyog
  2. What is SQLyog?
  3. Getting Started
  4. Importing only selected rows or importing the resultset of a query
  5. Conclusion
By: Insanely Great
Rating: starstarstarstarstar / 8
March 06, 2003

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

First of all you need to create a DSN to MS SQL Server’sPUBS database. Go to Control Panel->Administrative Tools->Data Sources.You will get a dialog as Figure A.

Figure A

 

You can create a new DSN by clicking on the Add button andselecting the right options from the wizard.

Now connect to your MySQL server by giving some simpleinformation to SQLyog (like Hostname, Username, Password, Port etc.). Create adatabase through SQLyog by selecting DB->Create Database… or using thekeyboard shortcut Ctrl+D. Give the database name say My PUBS. After thedatabase has been created, select the Database in the left hand tree window ofSQLyog ( i.e. the object browser ) and select Tools->ODBC Import… You willget a window like Figure B.

Figure B

 

The wizard also allows you to Import data from another MySQLData Source but since we are dealing with an ODBC source we choose Import FromOther Source… and press Next >. Remember to select the correct database inMySQL in which you want to import data in the combo dropdown. The next dialog FigureC will ask you the source DSN details. Fill up the following details in thedialog –

System/User DSN – The DSN you just created for MS SQLServer PUBS.

UserName – Username for the DSN.

Password – Password for the DSN.

and press Next.

Figure C

 

You will get a screen like Figure D. From this screenyou can specify whether to copy all the data from the source, or you can entera SQL query to select particular records.

Figure D

 

If you select Copy table(s) from the data source, you willbe presented with Figure E.

Figure E

 

Clicking on the transform button (which will be availableonly if you select a table) loads up the Column Mapping and TransformationDialog as shown in Figure F.

Figure F

 

Through this option you can change the properties of targetfields that will be imported in MySQL e.g. you can specify the data type of afield or you can say that it should be a NOT NULL field.

One powerful feature about the column mapping is that youcan specify which column you want to import in MySQL or which column you wantto fill with NULL values in the target MySQL database while importing data.

By default SQLyog will map all the columns from the sourcetable. If you want to ignore a column say phone as shown in FigureF, you can choose <ignore> option for that field in the Destinationcolumn of the GRID. An example is shown in Figure G.

Figure G

 

Moreover if you want that a field in the Destination tableto be filled with NULL value then choose <ignore> option for thecorresponding field in the Source column of the Grid. One example is shown in FigureH.

Figure H

 

Also you can insert same data for two or more destinationfield by choosing the same field in the source column of the GRID i.e. you canfill the First Name and the Last Name with First Name (I don’t know why youwill do that!!!).



 
 
>>> More MySQL Articles          >>> More By Insanely Great
 

blog comments powered by Disqus
   

MYSQL ARTICLES

- Xeround Releases Free Version of MySQL Cloud...
- Oracle Announces New MySQL Specialization
- Constant Contact Chooses SkySQL for MySQL Su...
- Revoke Statement in MySQL
- The Grant Statement in MySQL
- SuccessBricks Announces ClearDB Availability...
- Building a PHP ORM: Deploying a Blog
- TROSYS Launches Free MySQL Manager and Admin...
- Building an ORM in PHP: Domain Modeling
- Building an ORM in PHP
- MySQL Leads Open Source Market, Gets Cluster...
- Oracle Announces Milestone Release for MySQL
- How to Stop SQL Injection Attacks
- New Defragmentation Solution for SQL Server
- Comparison of MyISAM and InnoDB MySQL Databa...


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 3 - Follow our Sitemap

Dev Shed Tutorial Topics: