21 December 2010

Konversi MSSQL ke Mysql

Note pribadi... biar ga lupa..



MSSQL
mySQL
Note
[ " nama kolom
] "
+ concat( operasi string
coalesce coalesce
cast cast(EXPR, TYPE) TYPE = BINARY[(N)],      CHAR[(N)],      DATE,      DATETIME,      DECIMAL[(M[,D])],      SIGNED [INTEGER],      TIME,      UNSIGNED [INTEGER]
DATEDIFF(DAY, TGL1, TGL2) DATEDIFF(TGL2, TGL1) SELISIH DALAM HARI, TGL1 = GETDATE()/NOW()
DATEDIFF(MONTH, getdate(), expireddate) DATEDIFF( expireddate, NOW()) DIV 30 bisa pake period_diff cuman diformat tapi ga nerima inputan tanggal, harus diformat dulu ke yyyymm si tanggalnya
datediff lgsg ditaro di where ga bisa, jadiin subquery dulu baru di where
cast ke varchar otomatis
select top 10 * from table select * from table limit 10
convert(varchar, Tanggal , 102) date_format(tanggal, %Y.%m.%d)
if (select count(*) from tablex) > 1 then ga adaa
if exists then insert ignore
datepart(quarter, tgl) quarter(tgl)
datepart(weekday, tgl) weekday(tgl) sqlserver start dari minggu = 1, mysql start dr senin = 0
datepart(week, tgl) weekofyear(tgl)
day(), month(), year() sama
coalesce() sama
nested subquery referencing cuman kuat 1 level