文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>tsql2mysql.exe 使用说明

tsql2mysql.exe 使用说明

时间:2010-08-24  来源:909413335

tsql2mysql.exe下载地址 http://sourceforge.net/projects/tsql2mysql/   国外的哥们用C++做的一个基于命令行的批量转换存储过程的工具,从MSSQL转化成MYSQL。   操作步骤如下: 1:备份出SQL SERVER存储过程,使用ANSI编码,UTF8的支持。一个文件内可以有一个或者多个存储过程 2:

D:\tsql2mysql1.1>tsql2mysql <c:\tsql.txt > c:\mysql2.txt

3:导入到MYSQL数据库。

127.0.0.1~root@localhost~test>source c:\mysql2.txt


下面贴出英文操作说明:

=====================================================================

Tsql2mysql is a tool designed to help with conversion of stored procedures from Microsoft T-SQL to MySQL, ANSI-based, syntax. It does not do a complete conversion, in most cases you will probably have to make manual changes too.

How to run

The tool is command line based, reads from standard input and writes to standard ouput. It works with script files and does not connect to the database. To use it, take the following steps:

   - dump your procedures from SQL Server database to script files. Use ANSI format, UTF is not supported. You can have one or several procedures in every file

   - run the tool with the following command: tsql2mysql <[infile] >[outfile]

   - load the result into MySQL tool, for example the Query Browser, run it, correct errors, review out-commented code

 

What it does

Tsql2mysql does the following:

 1) converts CREATE PROCEDURE/FUNCTION syntax

 2) adds semi-colon at the end of statements

 3) converts IF and WHILE statements to MySQL syntax

 4) sorts the code in the correct order, with declarations at the top and instructions after that

 5) removes @, [ and ] from identifiers

 6) converts comments to MySQL syntax (a space in the 3rd position for -- comments)

 7) adds a CONTINUE HANDLER FOR NOT FOUND if the procedure contains cursors

 8) comments out GOTO and labels (you will have to restructure this yourself, since there is no GOTO in MySQL stored procedures)

 9) converts some data types (nvarchar, identity, smalldatetime, money, smallmoney)

 10)Converts function with a direct MySQL correspondence (getdate, getutcdate, len, replicate)

 11)Converts SQL Server temporary tables (the INTO #temptable) to MySQL CREATE TEMPORARY TABLE

What it does not do

The tool does not convert GOTO:s and labels. There are no GOTO:s in MySQL stored procedures. You will have to solve this by hand. The tool comments them out by adding a comment before the statement:

-- Can not be converted: GOTO wherever

The tool does not add MySQL/ANSI error handlers to the code. It the old procedures does error handling the Microsoft way, this should probably be done.

Feedback and bug reports

Your comments and suggestions are welcome. Be sure to include the original procedure/function code if you submit a bug report or request.

Changes in version 1.1

Version 1.1 includes convertion of SQL Server temporary table syntax. It also handlas CASE statements better, supports very large SQL statements and features improved pretty-printing of the code.


相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载