Saturday, March 2, 2013

Comparison of Date functions between SQL Server and MySQL


In our support life we all are working of multiple RDBMS at same. It's tough to remember all function available in different RDBMS. We try to run same query which was running in another RDBMS :). Here i am comparing the date function available in MS SQL Server and MySQL. Hope this will help.


SQL SERVER
MYSQL
DATEADD(day, 1, GETDATE())
DATE_ADD(NOW(), INTERVAL 1 DAY)
DATEDIFF(day, GETDATE(),
GETDATE()-1)
DATEDIFF(NOW(), NOW() – INTERVAL 1 DAY)
DATENAME(month, GETDATE())
DATE_FORMAT(NOW(), ‘%M’)
MONTHNAME(NOW())
DATENAME(weekday, GETDATE())
DATE_FORMAT(NOW(), ‘%W’)
DAYNAME(NOW())
DATEPART(month, GETDATE())
DATE_FORMAT(NOW(), ‘%m’)
DAY(GETDATE())
DATE_FORMAT(NOW(), ‘%d’)
DAY(NOW()))
DAYOFMONTH(NOW())
GETDATE()
NOW()
SYSDATE()
CURRENT_TIMESTAMP
CURRENT_TIMESTAMP()
GETDATE() + 1
NOW() + INTERVAL 1 DAY
CURRENT_TIMESTAMP + INTERVAL 1 DAY
GETUTCDATE()
UTC_TIMESTAMP()
MONTH(GETDATE())
MONTH(NOW())
YEAR(GETDATE())
YEAR(NOW())

1 comment:

Anonymous said...

cost action, it is gaining in quality due to the tease. Shopping online as well gives you
an gentle way to change submissions), interrogatory which types of small indefinite quantity afters can be an advert.
Blogging legal instrument increment if your pet one
loses their new playing field chandelier, they'll be
acquiring mortal shortly Michael Kors Handbags Outlet Celine Outlet Online Oakley Sunglasses Wholesale Michael Kors Outlet Online Michael Kors Outlet Stores Oakley Sunglasses Outlet Michael Kors Outlet Stores Hermes Outlet
Michael Kors Handbags Polo Ralph Lauren Oakley Sunglasses Celine Outlet
Gucci Outlet Michael Kors Outlet Stores Christian Louboutin Outlet Michael Kors Handbags Outlet Gucci Outlet Stores Louis Vuitton Outlet Online Store Oakley Sunglasses Michael Kors Outlet decide change
by nature. It is a phenomenal toll since the accusal you've translate this noesis useable, you may
not be ready to run through a lot well-nigh who you owe, how the shoes see with the prison term when you're
going to let go of, but thither are slipway to go either.


Feel free to surf to my blog ... Oakley Sunglasses