I got some problem with the guys that they want to know the exact difference between the syntax of MS Sql and My Sql. So I like to write this article on this blog. As you see my articles, I have also write an article for the commercial difference between these two Databases. You can see this article on the following url:
http://vijaymodi.wordpress.com/2007/03/28/my-sql-vs-ms-sql/
Now I like to give the syntax difference between these two databases. Let me start it now…
> If you want to retrieve the first (Top) four rows from a table by using query you have to write TOP in MS Sql. While for the same purpose, you need to write LIMIT in mysql. The syntax are as follows:
MS SQL:
SELECT TOP(4) * FROM TableName ORDER BY FieldName
MY Sql:
SELECT * FROM TableName ORDER BY FieldName LIMIT 4
> My Sql can insert multiple rows at a time, while MS Sql cannot.
MS SQL:
INSERT INTO tablename VALUES (1,'AAA');
INSERT INTO tablename VALUES (2,'BBB');
INSERT INTO tablename VALUES (3,'CCC');
MY SQL:
INSERT INTO tablename
VALUES (1,'AAA') , (2,'BBB') , (3,'CCC');
> MSSQL doesn't have CHARACTER_LENGTH. Provides the Provides CHARACTER_LENGTH.LEN and DATALENGTH functions instead (the latter is especially valid for 'special' data types like the TEXT type).while MYSQL
Aliases: CHAR_LENGTH, LENGTH. Note that MySQL removes trailing (not leading) spaces from CHAR values before counting.
To See the other more important difference visit the following link:
very interesting, but I don’t agree with you
Idetrorce
hi Idetrorce,
Let me know, why are you not agree? So that I can change it. Thank you for comment.
Vijay Modi
Hi To all
very good..Thank you for cleared my doubt and also very new. You given that answer with example very good.
Thank you for your information
hey i wanna added n more diff —-Technical – As of versions 4.x MySQL does not support views, triggers, stored procedures, user defined functions, XML, while all these are suported by MS SQL
Non Technical – MS SQL is an expensive (*relatively*) proprietory RDBMS developed & owned by Microsoft Corporation while MySql is an open source RDBMS developed & maintained by MySQL AB of sweden with free as well as paid enterprise versions available.
kkkkkkkkkkkkk
Love me
Does MySql support using the CURSOR?
please help me in linux environment , i use my sql but in windows environment use ms-sql. how can i install ms-sql in linux machine…
Hi Lorenzo Lowrince ,
yes MySQL Supports CURSOR. Read the following article for this.
http://www.roseindia.net/sql/mysql-example/mySQL-cursor.shtml
Regards,
Vijay Modi
not so good
very interresting
Pingback: MSSQL vs(Syntax) MySQL | ViMã Software Solution
Someone is messing with thumbs. Involve captcha and accounts
Hi there,
Thank you for this post. I just want to make sure that I understand the MSSQL syntax correctly after reading this post.
* Is the syntax exactly the same as MySQL? Except for some small change you mentioned within your post. eg. TOP(4) instead of LIMIT 4.
Are there any more changes in the syntax that I should be aware of when using the MSSQL database engine? I’ve been using MySQL for years now and MSSQL seems to be a little different.
Thank you
Vijay,
Your post is helpful. My team is carrying out a migration of some applications from Microsoft platforms to LAMP.
To add to you list of Syntax differences, it’s crucial to look into all of the date function differences between MSSQL and MySQL. Here is a URL with the difference date functions listed:
http://www.w3schools.com/sql/sql_dates.asp
Thanks,
Snowball119