12. MSSQL to MariaDB DATA TYPE MAPPING2
SQL Server MariaDB
tinyint TINYINT (UNSIGNED)
smallint SMALLINT
int
MEDIUMINT
INT
bigint BIGINT
? ??
SQL Server MariaDB
Decimal(p,s) DECIMAL(M,D)
? ?? ???
????
13. MSSQL to MariaDB DATA TYPE MAPPING - ??2
SQL Server MariaDB
float(n) FLOAT(N)
float(24) FLOAT(M,D)
float(53)
DOUBLE(M,D)
REAL(M,D)
? ?? ???
SQL Server MariaDB
bit
BIT
bool / boolean
? BIT
????
14. MSSQL to MariaDB DATA TYPE MAPPING - ??2
SQL Server MariaDB
datetime2/datetime DATETIME
date DATE
time TIME
smalldatetime TIMESTAMP
smallint YEAR
? ?? ? ??
????
15. MSSQL to MariaDB DATA TYPE MAPPING - ??2
SQL Server MariaDB
nchar(n) / char(n) CHAR
nvarchar(n|max)/varchar(n|max)
VARCHAR
TINYTEXT
TEXT(M)
MEDIUMTEXT
LONGTEXT
nvarbinary(n|max)/varbinary(n|max)
TINYBLOB
BLOB
MEDIUMBLOB
LONGBLOB
? ??
????
16. MSSQL to MariaDB DATA TYPE MAPPING - ??2
SQL Server MariaDB
hierarchyid ?
uniqueidentifier ?
sql_variant ?
table ?
? MSSQL ?? ??? ??
????
26. MariaDB vs MSSQL ?? ??
?? ??
1
? ? SQL Server MariaDB
?? ??
ALTER TABLE table_name
ADD column_name column_property
ALTER TABLE table_name
ADD column_name column_property;
?? ??
ALTER TABLE table_name
ALTER COLUMN column_name
new_column_property
ALTER TABLE table_name
MODIFY COLUMN column_name
new_column_property;
?? ??
EXEC sp_rename
Table_name.Old_column_name New_column_name
ALTER TABLE table_name
CHANGE COLUMN Old_column_name New_column_name
new_column_property;
?? ??
ALTER TABLE table_name
DROP column_name
ALTER TABLE table_name
DROP COLUMN column_name;
?? ??
EXEC sp_addextendedproperty
@name=N¨property_name¨,
@value=¨description¨ ´
ALTER TABLE table_name
MODIFY COLUMN column_name
column_property COMMENT `description¨;
? ? SQL Server MariaDB
???
??
CREATE TABLE [schema].table_name
( column_name data_type column_constraints,
´
table_constraints )
)
[ON filegroup / partition_scheme]
CREATE [OR REPLACE] TABLE [IF NOT EXISTS] tbl_name
(create_definition,...) [table_options ]
... [partition_options]
?????
??
?? ?? ???:
CREATE TABLE #table_name
?? ?? ???:
CREATE TABLE ##table_name
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
(create_definition,...) [table_options ]
... [partition_options]
27. References
? 3rd Party Tools
C SQL Server Migration Assistant for MySQL (MySQLToSQL)
https://msdn.microsoft.com/en-us/library/hh313109(v=sql.110).aspx
C MySQL Workbench: Database Migration
http://www.mysql.com/products/workbench/migrate/
? ??
C ???, ???? DBA? ?? Real MySQL, ????, 2012
C ???, MariaDB 10.0? MySQL 5.6? ??? ??? Real MariaDB, ????, 2014
C ???, MariaDB ?? ?? ???, ?????, 2014