Correspondence between data types in SQL Server and data types in MySQL (goto)

Source: Internet
Author: User
Tags goto mssql

Correspondence between data types in SQL Server and data types in MySQL (EXT): 78899477

One, SQL Server and MySQL data storage differences

1, datetime in SQL Server, reserved to microseconds (the second decimal point 3 bits), and MySQL only retained to the second, whether the conversion will affect the business, if the impact, you need to add a field specifically to store microseconds or milliseconds, While MySQL does not have the time data type accuracy of microseconds or milliseconds, MySQL provides related processing functions for microseconds microsecond, extract, and Date_format

2. mysql uses tinyint instead of SQL Server bit

3, self-increment processing, MySQL's self-increment step with increment value is the whole instance unification, cannot change each table dynamically, so here in the process of conversion, for Auto_increment, according to the instance's setting to handle

Ii. the correspondence between SQL Server and MySQL data types

Id SQL SERVER Mysql Description
1 bigint bigint
2 Binary Binary
3 Bit tinyint The bit type of SQL Server, for zero, is recognized as false, and non-0 values are recognized as true.
There is no specified bool type in MySQL, and tinyint is generally used instead of
4 Char Char
5 Date Date
6 Datetime Datetime Note that MSSQL is retained to microseconds (3 decimal digits after seconds), while MySQL remains only to seconds
7 DateTime2 Datetime Note that MSSQL is retained to microseconds (7 decimal digits after seconds), while MySQL remains only to seconds
8 DateTimeOffset Datetime Note that MSSQL's reserved time zone, which requires the program to convert itself
MSSQL reserved to microseconds (7 decimal digits after seconds), while MySQL remains only to seconds
9 Decimal Decimal
10 Float Float
11 Int Int
12 Money Float Default conversion to decimal (19,4)
13 NChar Char SQL Server to MySQL by the normal number of bytes to go
14 ntext Text
15 Numeric Decimal
16 nvarchar varchar
17 Real Float
18 smalldatetime Datetime
19 smallint smallint
20 SmallMoney Float Default conversion to decimal (10,4)
21st Text Text
22 Time Time Note that MSSQL retains a decimal point of 8 digits after the second, while MySQL remains only to seconds
23 Timestamp Timestamp
24 tinyint tinyint
25 uniqueidentifier varchar (40) The UUID () that corresponds to MySQL is set to the text type.
26 varbinary varbinary
27 varchar varchar
28 Xml Text MySQL does not support XML and is modified to text

Correspondence between data types in SQL Server and data types in MySQL (goto)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.