按计划今天着手进行将后台数据库从MS SQL Server2000转换成MySQL5.1.3。目的是便于发布软件的测试版本。
1. 驱动: mysql-connector-odbc-5.1.11-win32.msi。测试Win7*64, XP通过。
2. MySQL_5.1.3免安装版。
3. MSS2SQL工具软件转换SQLServer2000的表结构。一共转换了43个表。
4. MSSQLServer2000中的存储过程转换到MySQL。
//To-Do
5. SQL函数的区别
(1)select * from A where convert(nvarchar(10),tMakeDate,121)>=‘2015-05-08‘
-> SELECT * from A WHERE DATE_FORMAT(tMakeDate, ‘%Y-%m-%d‘)>=‘2015-05-08‘
(2)select * from A where isnull(cMaker, ‘‘)<>‘‘
-> SELECT * from Awhere IFNULL(cAuditMan,‘‘)<>‘‘
(3)select newid()
->SELECT UUID()
select getdate()
->SELECT NOW()
(4)update a set a.字段1=b.字段2 from 表A a, 表B b where a.MID=‘1‘
->update 表A a, 表B b set a.字段1=b.字段2 where a.MID=‘1‘
(5)select top 10 * from A
-> select * from A LIMIT 10
(6)select convert(nvarchar(10),getdate(),121) as Date1, convert(nvarchar(10),getdate()-2,121) as Date2
->SELECT DATE_FORMAT(NOW(),‘%Y-%m-%d‘) as Date1, DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 2 DAY), ‘%Y-%m-%d‘) as Date2
(7)insert into A(MID,iType) select newid(), 1 where not exists(select 1 from A where iType=1)
->INSERT INTO A(MID, iType) SELECT UUID(), 1 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM A WHERE iType=1)
Dual虚拟表
6. 设置MYSQL为UTF8编码
修改my.ini配置文件,参考:http://blog.csdn.net/red4711/article/details/6007248
7. MYSQL中不支持匿名块,也就是说过程性语句IF,THEN必须放在存储过程中执行。