MySQL Forums
Forum List  »  Quality Assurance

Function conversion
Posted by: Romilton Fernando
Date: December 22, 2011 11:51PM

Hi Everybody,
Am new for mysql. So i need to convert a function from mssql to mysql please help me its urgent.
Conversion function is below :

CREATE FUNCTION GetWeekDayNameOfDate
(
@Date datetime
)
RETURNS nvarchar(50)
BEGIN

DECLARE @DayName nvarchar(50)

SELECT
@DayName =
CASE (DATEPART(dw, @Date) + @@DATEFIRST) % 7
WHEN 1 THEN 'Sunday'
WHEN 2 THEN 'Monday'
WHEN 3 THEN 'Tuesday'
WHEN 4 THEN 'Wednesday'
WHEN 5 THEN 'Thursday'
WHEN 6 THEN 'Friday'
WHEN 0 THEN 'Saturday'
END

RETURN @DayName

END

GO

With regards,
A.Romilton Fernando....

Options: ReplyQuote


Subject
Views
Written By
Posted
Function conversion
1634
December 22, 2011 11:51PM


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.