Summary of methods for SQL Server script to MySQL script

Source: Internet
Author: User
Tags mysql in

1, MySQL in the footsteps of SQL to a semicolon (;) end, this is more rigorous than SQL Server.

2. All keywords must be added ', such as status replaced by ' status ', ' by the key '.

3. The dbo of SQL Server. [,] not supported in MySQL, should be removed.
4, IsNull replace Ifnull.
5, RowNumber does not support, you can use SELECT @rownum: [email protected]+1 as Pagerownum from (SELECT @rownum: =0) r instead.
6. CONCAT () instead of +, the number is added except.

7. Group_concat instead of FOR XML Path (").

The @ @ROWCOUNT in 8.SQL server is replaced with MySQL Row_count ().

9. TOP to change the notation of limit.

10. Declare a variable and assign a value to multiple variables from a query statement by: =, as follows:

/* * Declare variable, accept the number @userName, the initial value is: 0 */ Declare   int default 0 ;//The default value is 0, note that no parentheses are on either side of the default value. DECLARE  loginname varchar (a);//Set Count_user=0/* * The query is named: Number of users @userName */Select @count_user:=count (1), @loginname: = UserName from login;

11. Time Format: Date_format (now (), '%y%m%d ')--20150124 can refer to http://blog.csdn.net/kangbrother/article/details/7030304 in detail.

12. Type conversion to use cast can refer to http://www.nowamagic.net/librarys/veda/detail/2044.

13. Conditional judgment, if then ... end if; If then.. else.. End If;

Len () in 14.SQLSERVER corresponds to length () in MySQL.

15. Modify the data

1.Update`Order', OrderordertransSET`Order`. Cyclesort=Orderordertrans. RIDwhere`Order'. ' Code '=Orderordertrans. ' Code ';//support for MySQL and SQL Server2.UpdateASetA.defaultcycledelivedate=NULL  from [Order]AwhereA.cyclesort>@CurrentCycleSort  andA.cycle_group=@cycleGroup //Support for server, MySQL not supported

Summary of methods for SQL Server script to MySQL script

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.