Tuesday, December 20, 2011

Display current year, month and date


--Display name of the current month and Year--
Select DateName( Month, getDate() ) + ' ' + DateName( Year, getDate() )
--Display current year, month and date--
 SELECT 'Year: ' + CONVERT(VarChar(4), YEAR(GETDATE()))    + ', Month: ' + CONVERT(VarChar(2), MONTH(GETDATE()))
    + ', Day: ' + CONVERT(VarChar(2), DAY(GETDATE()))

No comments:

Post a Comment