MySQL Forums
Forum List  »  Newbie

Datepart command
Posted by: Aw Dang
Date: February 01, 2005 01:56PM

Can someone help me with the equivalent MySQL command for the datepart command in MSSQL?

For example, here is some code I need to convert to MySQL:
SELECT DISTINCT InputMethod
FROM ReferenceStatistics
WHERE
(
(
CAST(CAST(DATEPART(Month, Created_DT) AS VARCHAR) + '/' + CAST(DATEPART(Day, Created_DT) AS VARCHAR) +
'/' + CAST(DATEPART(Year, Created_DT) AS VARCHAR) AS SMALLDATETIME)
BETWEEN '#Start1#' AND '#End1#'
AND InputMethod = 2
)
OR
(
CAST(CAST(dataMonth AS VARCHAR) + '/' + '01' + '/' + CAST(dataYear AS VARCHAR) AS SMALLDATETIME)
BETWEEN '#Start1#' AND '#End1#'
AND InputMethod = 1
)
)



I'm getting errors on the datepart areas of the code. Please help!

Options: ReplyQuote


Subject
Written By
Posted
Datepart command
February 01, 2005 01:56PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.