获得英语日名称 [英] Getting English Day Name

查看:85
本文介绍了获得英语日名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我目前正在使用DAYOFWEEK函数并将CASE语句放入

获取英文日名称。例如:


SELECT

CASE DAYOFWEEK(当前日期)

当1'那个星期天''

当2'那个'星期一''

当3'那么'TUEDAY''

当4'那么'WEDNESDAY''

当5'那么'星期四''

当6'那么'星期五'

当7'那么'星期六''

结束

来自SYSIBM.SYSDUMMY1


函数DAYNAME不起作用(或者我没有正确使用它)。是

有没有其他功能可用于获取英文日名称

为字符串?如果可以使用DAYNAME,它的参数应该是什么?


提前致谢,

Lalit

解决方案

singlal写道:

函数DAYNAME不起作用(或者我没有正确使用它)。是否有任何其他功能可用于将英文日名称
作为字符串?如果可以使用DAYNAME,它的参数应该是什么?




你正在使用哪个版本的DB2?


我不喜欢我相信你根本没有尝试过这个功能;只需一个简单的测试即可给出正确的答案:


D:\工作> db2值dayname(当前日期)

>
1

------------------------------------ ---------------------------------------

Wednesday


D:\工作> db2值dayname(当前时间戳)


1

------ -------------------------------------------------- -------------------

Wednesday

1条记录已选中。

或快速搜索产品文档(可在线获取:
http://publib.boulder.ibm.com/infoce.../v8//index.jsp

会显示:


DAYNAME标量函数

- DAYNAME - ( - expression - )-------- ---------------------------><




schema是SYSFUN。


返回一个大小写混合的字符串,其中包含基于参数的日期部分的日期名称(对于

示例,星期五)在数据库启动时的区域设置




参数必须是日期,时间戳或有效的字符串

既不是CLOB也不是LONG VARCHAR的日期或时间戳的表示。

在Unicode数据库中,如果提供的参数是图形字符串,则它是第一个

在执行函数之前转换为字符串。


函数的结果是VARCHAR(100)。结果可以为null;如果

参数为null,则结果为空值。

Jan M. Nelken


Jan M Nelken写道:

singlal写道:

函数DAYNAME无效(或者我没有正确使用它)。是否有任何其他功能可用于将英文日名称
作为字符串?如果可以使用DAYNAME,它的参数应该是什么?



你正在使用哪个版本的DB2?




好​​问题鉴于DAYNAME功能已经存在于V7和

可能更早。


-

Knut Stolze
DB2信息集成开发

IBM德国


我正在使用DB2 v 7.1。我不知道为什么但D​​AYNAME不是工作的b $ b。我的查询是SELECT DAYNAME(CURRENT TIMESTAMP)。错误我是

得到的是SQLCODE = -440,错误:姓名DAYNAME没有功能

有相同的论点在当前的路径中找到。


Hi,
I am currently using DAYOFWEEK function and putting CASE statement to
get english day name. For example:

SELECT
CASE DAYOFWEEK(CURRENT DATE)
WHEN 1 THEN ''SUNDAY''
WHEN 2 THEN ''MONDAY''
WHEN 3 THEN ''TUEDAY''
WHEN 4 THEN ''WEDNESDAY''
WHEN 5 THEN ''THURSDAY''
WHEN 6 THEN ''FRIDAY''
WHEN 7 THEN ''SATURDAY''
END
FROM SYSIBM.SYSDUMMY1

The function DAYNAME is not working (or I am not using it rightly). Is
there any other function that can be used to get the english day name
as string? If DAYNAME can be used, what should be its parameter?

Thanks in advance,
Lalit

解决方案

singlal wrote:

The function DAYNAME is not working (or I am not using it rightly). Is
there any other function that can be used to get the english day name
as string? If DAYNAME can be used, what should be its parameter?



Which version of DB2 you are using?

I don''t believe you tried this function at all; just a simple test would give
you correct answer:

D:\Working>db2 values dayname(current date)

1
---------------------------------------------------------------------------
Wednesday

D:\Working>db2 values dayname(current timestamp)

1
---------------------------------------------------------------------------
Wednesday
1 record(s) selected.
Or a quick search for product documentation (available online at:
http://publib.boulder.ibm.com/infoce.../v8//index.jsp)
would reveal that:

DAYNAME scalar function

-DAYNAME--(--expression--)-----------------------------------><



The schema is SYSFUN.

Returns a mixed case character string containing the name of the day (for
example, Friday) for the day portion of the argument based on the locale when
the database was started.

The argument must be a date, timestamp, or a valid character string
representation of a date or timestamp that is neither a CLOB nor a LONG VARCHAR.
In a Unicode database, if a supplied argument is a graphic string, it is first
converted to a character string before the function is executed.

The result of the function is VARCHAR(100). The result can be null; if the
argument is null, the result is the null value.
Jan M. Nelken


Jan M. Nelken wrote:

singlal wrote:

The function DAYNAME is not working (or I am not using it rightly). Is
there any other function that can be used to get the english day name
as string? If DAYNAME can be used, what should be its parameter?



Which version of DB2 you are using?



Good question given that the DAYNAME function already existed in V7 and
probably even much earlier.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany


I am working with DB2 v 7.1. I am not sure why but DAYNAME is not
working. My query is SELECT DAYNAME(CURRENT TIMESTAMP). Error I am
getting is SQLCODE = -440, ERROR: NO FUNCTION BY THE NAME DAYNAME
HAVING COMPATIBLE ARGUMENTS WAS FOUND IN THE CURRENT PATH.


这篇关于获得英语日名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆