Monday, September 18, 2006

T-SQL to MySQL procedure converter released

Yesterday evening I finally released the procedure converter at I am quite satisfied with the result, it covers quite a lot. But the user interface is virtuallt non-existant, and the parsing needs some improvement. The problem is that for more complex conversion tasks (like shifting order for function parameters) I would need better parsing of the source code.

  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
  5. after that
  6. removes @, [ and ] from identifiers
  7. converts comments to MySQL syntax (a space in the 3rd position for -- comments)
  8. adds a CONTINUE HANDLER FOR NOT FOUND if the procedure contains cursors
  9. comments out GOTO and labels (you will have to restructure this yourself, since there is no GOTO in MySQL stored procedures)
  10. converts some data types (nvarchar, identity, smalldatetime, money, smallmoney)
  11. Converts function with a direct MySQL correspondence (getdate, getutcdate, len, replicate)
  1. No conversion of GOTO:s and labels
  2. no MySQL error handling added


SANIKA said...

how to execute the .exe file.For example if I have a .sql file please tell me the steps I should follow to convert it to mysql.

galiego710 said...

I will add somewhat yet
[T-SQL] "a" + "b" + "c"
[MySQL] concat("a", "b", "c")

[T-SQL] getdate() - 2
[MySQL] date_add(now(), interval -2 day)

[T-SQL] datepart(weekday,date)

galiego710 said...
This comment has been removed by the author.
galiego710 said...
This comment has been removed by the author.