Pankaj Tahiliani

  Home  |   Contact  |   Syndication    |   Login
  34 Posts | 0 Stories | 49 Comments | 0 Trackbacks

News

Twitter












Archives

Post Categories

datename

DATENAME function is used to get string of the specified datepart of the specified date.DATEPART Return of the specified date an integer that represents a specific dateConsider a problem where we have to converting a date to display in the MON YYYY format where "MON" is the 3 character month such as "Jan", "Feb", "Mar", etc.use NORTHWIND;SELECT CASE DATEPART(mm,OrderDate) WHEN 01 THEN 'Jan' WHEN 02 THEN 'Feb' WHEN 03 THEN 'Mar' WHEN 04 THEN 'Apr' WHEN 05 THEN 'May' WHEN 06 THEN 'Jun' WHEN 07 THEN ......