SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 MySQL CAST
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

tranquilraven
Starting Member

19 Posts

Posted - 06/24/2012 :  14:23:34  Show Profile  Reply with Quote
Could someone enlighten me as to why this CAST function won't work in MySQL? Thank you in advance.

SELECT OrderNumber, OrderDate, ShipDate, CAST(ShipDate - OrderDate AS INTEGER) AS DaysElapsed
FROM Orders

visakh16
Very Important crosS Applying yaK Herder

India
47040 Posts

Posted - 06/24/2012 :  14:36:13  Show Profile  Reply with Quote
would be better off posting it in MySQL forum. This is MS SQL Server forum

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22460 Posts

Posted - 06/26/2012 :  05:33:12  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
Are you trying to find out day difference? Mysql doesnot support CASTing to integer. Use Signed

SELECT OrderNumber, OrderDate, ShipDate, CAST(ShipDate - OrderDate AS SIGNED) AS DaysElapsed
FROM Orders


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000