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!
SELECT DATENAME(dw, GETDATE())
Reference : Pinal Dave (https://blog.sqlauthority.com)
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….