Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jung1975
Aged Yak Warrior
503 Posts |
Posted - 2005-08-08 : 22:49:49
|
| How can I write a UDF that returns day of the week?For example, '20050808' returns 'Monday'.. |
|
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2005-08-08 : 23:00:27
|
You can use the DATEPART function.DATEPART(w, dat) from memory..... |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-09 : 01:27:30
|
| Something likedeclare @d intdeclare @day varchar(10)select @d=datepart(w,'20050808')Select @day=Case when @d=1 then 'Sunday' when @d=2 then 'Monday'..end Return @dayMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|