Tuesday, March 17, 2009

How get month name,weekday name,year using sql

RETURN THE WEEKDAYNUMBER
select datepart(dw,getdate()) as weekdaynumber
RETURN THE WEEKDAYNAME
select datename(dw,getdate()) as weekdayname
RETURN THE CURRENTDATENUMBER
select day(getdate()) as currentdatenumber
RETURN THE CURRENTDATE
select GETDATE() as currentdate
RETURN THE CURRENTYEAR
select year(getdate()) as currentyear
RETURN THE CURRENTMONTHNUMBER
select month(getdate()) as currenmonthnumber
RETURN THE CURRENTDATENUMBER
select day(getdate()) as currentddatenumber
RETURN THE MONTHNAME
select datename(mm,getdate()) as currentmonthname

No comments: