diff. mysql & sql

Upload: taarifsan

Post on 09-Apr-2018

226 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/7/2019 diff. mysql & sql

    1/2

    Some of the difference between MSSQL and MYSQL Syntax are as follows:

    1) MSSQL support UDD(User Defined DataTypes), MYSQL does not support UDD

    2) Use of -- for comment a line purpose in MSSQL, in otherside use /* */ or-- comments

    3) Use prefix @symbol for variable in MSSQL, whereas in MYSQL remove @symbol.e.g. declare @test int -- MSSQL Syntax

    declare test int; --MYSQL Syntax

    4) End marker(;) not required in MSSQL but in MYSQL all statement end with

    marker (;)

    5) In MSSQL use SELECT getdate() for getting today's date , in MYSQL use SELECTnow()

    6) All queries should be available in Begin tran and Commit(Rollback) tran loop in

    MSSQL,

    whereas MYSQL Start transaction and commit(Rollback) transaction.

    7) Getting Top most record in MSSQL, Use SELECT TOP1 from Table_Name where

    In MYSQl SELECT from Table_Name where limit 1;

    8) For viewing table information use Sp_help Table_name in MSSQL, but in MYSQLuse show table_name;

    9) Use of + for concatenate two stings in MSSQLL whereas MYSQL SELECT

    concat('a','/','b')

    10)In MSSQL SP_HELPTEXT for viewing the content of sp in otherside use the

    following syntax.select routine_definition from information_schema.routines

    where specific_name =and routine_schema = ;

    11)For assigning value to variable use Set @variable1 = 'test' in MSSQL,

    but in MYSQL use Set variable =1 or set 1 into variable1;

    12)In MSSQl, use of IF statement syntax,

    ifBegin

    Statementend

    ElseBegin

    Statementend

    Whereas in MYSQL,if Then

    Statement;leave sp_label;

    end if;

  • 8/7/2019 diff. mysql & sql

    2/2

    13) In MSSQL Use RETURN Statement for returning values but in MYSQL use leave

    sp_level;

    14) The convert datatype Syntax in MSSQL is select convert(type,expression)whereas in MYSQL select convert(expression,type);

    15) In MSSQL the Dynamic SQL statement isSELECT @a ='SELECT * from Table_Name where

    execute (@a)

    othersidePrepare stmt1 from 'select * from Table_Name where column_name =?'

    Set @a ='Value';execute stmt using @a;

    Regards,Kavitha N