One of the db2 database migration to mssql records

Source: Internet
Author: User

A system was originally run on DB2 and now has the requirement to support mssql. The first day of the tossing process is as follows:
1. Find the powerdesigner table design file, generate the mssql script, and import it to the mssql database. (Scripts exported directly through db2 cannot be run on mssql at all)
 
2. When the script is imported, some statements report an error, resulting in failure to create some tables. The solution is to find out the table names of two different databases, use the comparison tool to find the tables that have not been created, adjust the table creation statements, and recreate them. At this time, there are not many tables that have not been successfully created. You can manually create one by one.
DB2: select tabname from syscat. TABLES where tabname like ....
Mssql: select name from sysobjects where name like ....
 
There are many problems in the operation process, such:
1. The timestamp type of mssql is different from the timestamp type function of db2. A table of mssql can only have one timestamp column. The value format of timestamp of mssql is 0x000000053ca5, and that of db2 timestamp corresponds to mssql datetime, the format of timestamp is 09:43:50. 290. Replace the timestamp of the export script with datetime.
 
2. DDL exported by the DB2 control center contains many items of DB2 itself, which is not suitable for other databases. For example, "restrict onupdate" reports an error in mssql: "message 156, Level 15, status 1, 20th line keyword 'restrict 'has a syntax error nearby ". The solution is to manually delete these statements.
 
3. Convert CLOB type to ntext type, and convert long vargraphic type to ntext type.
 
4. primary key constraint name error: Message 2714, level 16, status 5, 1st rows. An object named 'P _ KEY_1 'already exists in the database. Message 1750, level 16, status 0, 1st rows, cannot create constraints. See the preceding error message.
In mssql, primary key constraint names with the same name are not allowed. Change P_KEY_1 to P_KEY_2, P_KEY_3, and so on.
 
5. An error is reported during the import of statements containing the desc field. In mssql, desc is a keyword. The temporary processing method is to add double quotation marks to desc or change the name, for example, descpt. This also needs to be tested when running the system later.
 
Through the above operations and problem adjustments, the table is basically migrated from db2 to mssql, and the following are adjustments to views, stored procedures, functions, and so on.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.