I have been asked many times when there is DATENAME function available why do I go in exercise of writing UDF For the getting the day of the week. Answer is : I just like it! Here is Day of the Week Function Part 4 with the DATENAME way.

SELECT DATENAME(dw, GETDATE())
Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.
Discover more from SQL Authority with Pinal Dave
Subscribe to get the latest posts sent to your email.





5 Comments. Leave new
can i use locationization/globalisation in sqlserver queries.
i need month name in greek,german,turkish language
Hi Dave,
How can I use the DATENAME function within SSIS2005. I am importing a csv file and want to transform a date string field in the csv record from “YYYYMMDD” to “DDmonYY” (e.g. 20080715 to 15JUL08) . My output goes into a text file.
Any assistance is highly appreciated.
How would you go about get the date for this example.
Week Number = 4
Week Day = 3
Year = 2009
Result: 01/27/2009
Here’s the code for the date parts:
@week = DATEPART(WEEK, @date)
@day_number = DATEPART(WEEKDAY, @date)
@year = DATEPART(YEAR, @date) -1
Thanks,
Chris
Its really good site to know everythig from its one place……..Thanking U….
Pls tell me the Query, how to display Day of weeK in ascending order?
eg:
February
Friday
Monday
Thursday
Tuesday
This like i want to display….