Author |
Topic |
dirwin26
Yak Posting Veteran
81 Posts |
Posted - 2008-05-12 : 11:10:57
|
I am trying to look at a datetime date and am setting the column next to it to the corresponding day of the week. Instead I am getting the associated number of the monthDayofWeek DatecolumnNULL 2007-12-13 I want Dayofweek to be tuesday, or whatever the right day is for 12-13I'm using the below but I am getting the answer 13....not tuesday. I thought datename was for returning strings? Update TAbleset DayOfWeek = datename (day, DateColumn) |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-05-12 : 11:12:40
|
SELECT DATENAME(DAYOFWEEK, DateColumn) E 12°55'05.25"N 56°04'39.16" |
|
|
dirwin26
Yak Posting Veteran
81 Posts |
Posted - 2008-05-12 : 11:19:40
|
I tried putting it into an update statement and I still get the day of the month in number form, not day of the week as in tuesday. Any ideas on what's up?update tableset dayofweek= (select datename(day, datecolumn)) |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-05-12 : 11:24:47
|
quote: Originally posted by dirwin26 I tried putting it into an update statement and I still get the day of the month in number form, not day of the week as in tuesday. Any ideas on what's up?update tableset dayofweek= (select datename(day, datecolumn))
DO you think you used the solution you were provided with? |
|
|
dirwin26
Yak Posting Veteran
81 Posts |
Posted - 2008-05-12 : 11:27:48
|
'DAYOFWEEK' is not a recognized datename option. |
|
|
dirwin26
Yak Posting Veteran
81 Posts |
Posted - 2008-05-12 : 11:31:32
|
and as you know a select statement can't be used in an update unless you embed it in parenthases, unless there is something else I don't know. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-05-12 : 11:40:32
|
SELECT DATENAME(WEEKDAY, DateColumn)This is very easy so lookup in Books Online, btw. E 12°55'05.25"N 56°04'39.16" |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-05-12 : 11:41:54
|
quote: Originally posted by dirwin26 and as you know a select statement can't be used in an update unless you embed it in parenthases, unless there is something else I don't know.
I can spoon-feed you tooUPDATE TableSET DayOfWeek = DATENAME(WEEKDAY, DateColumn) E 12°55'05.25"N 56°04'39.16" |
|
|
cat_jesus
Aged Yak Warrior
547 Posts |
Posted - 2008-05-12 : 16:02:48
|
quote: Originally posted by dirwin26 and as you know a select statement can't be used in an update unless you embed it in parenthases, unless there is something else I don't know.
Something else you don't know? Impossible!An infinite universe is the ultimate cartesian product. |
|
|
|