How do I get the day of the week (in ddd format, so Mon, Tue etc.) in SQL ? I don't see anything about it in the CAST and CONVERT documentation..
+3
A:
Many ways to do it, here's one way:
SELECT LEFT(DATENAME(dw, GETDATE()), 3)
AdaTheDev
2009-11-09 15:46:49
+1
A:
You can't ddd out of the box but you can do the full day
e.g.
select datename(weekday,getdate())
returns 'Monday' and you can just take the first 3 letters.
John Nolan
2009-11-09 15:49:28
+1
A:
I would use
SELECT CONVERT(CHAR(3),DATENAME(weekday,GETDATE()))
so as to avoid using another function in the SQL, the conversion to a CHAR(3) implicitly takes the first 3 characters.
Jonathan
Fatherjack
2009-11-09 16:39:58