Differences

This shows you the differences between two versions of the page.

sql-server-to-mariadb [December 19, 2017 11:05 pm]
sqlines
sql-server-to-mariadb [June 18, 2018 2:20 pm] (current)
sqlines
Line 19: Line 19:
===== Migration Reference ===== ===== Migration Reference =====
 +  * [[/sql-server-to-mariadb#sql-language-elements|SQL Language Elements]]
  * [[/sql-server-to-mariadb#data-types|Data Types]]   * [[/sql-server-to-mariadb#data-types|Data Types]]
  * [[/sql-server-to-mariadb#built-in-sql-functions|Built-in SQL Functions]]   * [[/sql-server-to-mariadb#built-in-sql-functions|Built-in SQL Functions]]
 +  * [[/sql-server-to-mariadb#create-procedure-statement|CREATE PROCEDURE]]
  * [[/sql-server-to-mariadb#transact-sql-statements|Transact-SQL Statements]]   * [[/sql-server-to-mariadb#transact-sql-statements|Transact-SQL Statements]]
 +
 +===== SQL Language Elements =====
 +
 +Converting SQL language elements:
 +
 +| | **SQL Server** || **MariaDB** ||
 +| 1 | //string + string2 + ...// | String concatenation | CONCAT(//string, string2, ...//) ||
 +| 2 | @@IDENTITY | Returns the last-inserted identity value | LAST_INSERT_ID() ||
===== Data Types ===== ===== Data Types =====
Line 60: Line 70:
| 3 | DATEADD(//unit//, //value//, //exp//) | Add datetime interval | TIMESTAMPADD(//unit//, //value//, //exp//) | | 3 | DATEADD(//unit//, //value//, //exp//) | Add datetime interval | TIMESTAMPADD(//unit//, //value//, //exp//) |
| 4 | GETDATE() | Get the current date and time | NOW() | | 4 | GETDATE() | Get the current date and time | NOW() |
 +
 +===== CREATE PROCEDURE Statement =====
 +
 +Converting Transact-SQL stored procedures:
 +
 +| | **SQL Server** | **MariaDB** |
 +| 1 | CREATE PROCEDURE //name// | CREATE PROCEDURE //name// |
 +| 2 | //@param// //datatype// [= //default//]  [OUTPUT] | IN %%|%% OUT %%|%% INOUT //p_param// //datatype//  {{:exclamation.png|}} <sup>no defaults</sup>|
 +| 3 | Optional () for procedure parameters | () required |
 +| 4 | AS before the procedure body | Removed |
 +| 5 | BEGIN END is optional for the procedure body | BEGIN END required |
 +| 6 | Optional statement delimiter | ; is added after each statement |
 +| 7 | GO | Specified by DELIMITER command |
 +
 +For further information, see [[/sql-server-to-mariadb#transact-sql-statements|Conversion of Transact-SQL Statements]].
===== Transact-SQL Statements ===== ===== Transact-SQL Statements =====
Line 82: Line 107:
   
 +Transaction statements:
 +| | **SQL Server** || **MariaDB** |
 +| 1 | BEGIN TRANSACTION %%|%% TRAN | Begin a transaction | START TRANSACTION |
 +| 2 | COMMIT TRANSACTION %%|%% TRAN | Commit transaction | COMMIT |
 +| 3 | ROLLBACK TRANSACTION %%|%% TRAN | Rollback transaction | ROLLBACK |