Example 5 4 is a MySQL MyISAM table creation example. Example 5 5 is the 
DB2 conversion. The main changes include:
Changes in the data type according to data type mapping
Instead of auto_increment, 
generated by default as identity
 is used.
Example 5 4   Creating MySQL MyISAM table
mysql>create table itsotest1 (
         wk_id int(11) unsigned NOT NULL auto_increment,
         user_id int(11) unsigned default NULL,
         cnt int(10) unsigned default NULL,
         cat_id int(12) unsigned default NULL,
         status varchar(10) default NULL,
         PRIMARY KEY  (wk_id)) type=MyISAM;
Example 5 5   DB2 Conversion of MySQL MyISAM table creation 
db2>create table itsotest1(
       wk_id INT  NOT NULL GENERATED BY DEFAULT AS IDENTITY,
       user_id INT  default NULL,
       cnt INT  default NULL,
       cat_id INT default NULL,
       status VARCHAR(10)  default NULL,
       PRIMARY KEY  (wk_id));
Alter table
Alter table is a statement to change one or more properties of a table. The syntax 
of alter table for MySQL and DB2 UDB is quite similar and is shown in 
Example 5 6.
Example 5 6   MySQL and DB2 UDB alter table example
mysql>alter table itsotest1 modify status varchar(20);
db2>alter table itsotest1 alter column status set data type varchar(20)
Alter table in DB2 UDB does not support the dropping of columns, but this can be 
easily achieved using the temporary table. Scripts for doing this are shown in 
Example 5 7.
Example 5 7   DB2 UDB dropping column using temporary table
db2>create temporary table temp as 
       (select col1, col2, col4 from itsotable1)
    definition only not logged initially
db2>insert into temp select col1,col2, col3 from itsotable1
102 
MySQL to DB2 UDB Conversion Guide






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

san diego web hosting

 

Our partners: PHP: Hypertext Preprocessor Cheap Web Hosting JSP Web Hosting Ontario Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Java Hosting Cheapest Hosting

Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved