作业帮 > 英语 > 作业

SQL Servers2008中,如何将表中数据星期从英文转化为中文,并用一条语句来完成.

来源:学生作业帮 编辑:大师作文网作业帮 分类:英语作业 时间:2024/11/11 03:35:34
SQL Servers2008中,如何将表中数据星期从英文转化为中文,并用一条语句来完成.
TimeKey FullDateAlternateKey\x05DayNumberOfWeek\x05EnglishDayNameOfWeek
1\x052001-07-01 0:00:00\x051\x05\x05Sunday
2\x052001-07-02 0:00:00\x052\x05\x05Monday
3\x052001-07-03 0:00:00\x053\x05\x05Tuesday
4\x052001-07-04 0:00:00\x054\x05\x05Wednesday
5\x052001-07-05 0:00:00\x055\x05\x05Thursday
6\x052001-07-06 0:00:00\x056\x05\x05Friday
7\x052001-07-07 0:00:00\x057\x05\x05Saturday
8\x052001-07-08 0:00:00\x051\x05\x05Sunday
9\x052001-07-09 0:00:00\x052\x05\x05Monday
TimeKey FullDateAlternateKey DayNumberOfWeek\x05EnglishDayNameOfWeek
1\x052001-07-01 0:00:00\x05 1\x05\x05Sunday
2\x052001-07-02 0:00:00\x05 2\x05\x05Monday
3\x052001-07-03 0:00:00\x05 3\x05\x05Tuesday
4\x052001-07-04 0:00:00\x05 4\x05\x05Wednesday
5\x052001-07-05 0:00:00 \x055\x05\x05Thursday
6\x052001-07-06 0:00:00 \x056\x05\x05Friday
7\x052001-07-07 0:00:00 \x05 7\x05\x05Saturday
8\x052001-07-08 0:00:00 \x051\x05\x05Sunday
9\x052001-07-09 0:00:00 \x052\x05\x05Monday
SQL Servers2008中,如何将表中数据星期从英文转化为中文,并用一条语句来完成.
1.select datename(weekday,DayNumberOfWeekEnglishDayNameOfWeek
)
2.select datename(weekday,FullDateAlternateKey)
再问: 高手,你在琢磨一下
再答: select case when EnglishDayNameOfWeek = 'Sunday' then '星期日' when EnglishDayNameOfWeek = 'Monday' then '星期一' when EnglishDayNameOfWeek = 'Tuesday' then '星期二' when EnglishDayNameOfWeek = 'Wednesday' then '星期三' when EnglishDayNameOfWeek = 'Thursday' then '星期四' when EnglishDayNameOfWeek = 'Firday' then '星期五' when EnglishDayNameOfWeek = 'Saturday' then '星期六' else '' end from tableName 可以尝试下以上SQL 语句