473,789 Members | 2,634 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting English Day Name

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

SELECT
CASE DAYOFWEEK(CURRE NT 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.SYSDUMMY 1

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

Jan 18 '06 #1
11 11740
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 18 '06 #2
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
Jan 19 '06 #3
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.

Jan 19 '06 #4
singlal wrote:
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.


So what's the current function path?
Have you changed your operating system's clock at some time?
Can't you move to V8, given that V7 is out of service for over a year (and
V7.1 even longer)?

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Jan 19 '06 #5
Moving to V8 is out of my hand. It's an org wide decision that's
pending for a while now.

What do you mean by current function path? How do I find it? The
functions like DAYOFWEEK are working fine.

Jan 19 '06 #6
Here is the blurb on the function path. It is from the v7 infocentre:

Function Path
The concept of function path is central to DB2's resolution of
unqualified references that occur when you do not use the schema-name.
For the use of function path in DDL statements that refer to functions,
refer to the SQL Reference. The function path is an ordered list of
schema names. It provides a set of schemas for resolving unqualified
function references to UDFs and methods as well as UDTs. In cases where
a function reference matches functions in more than one schema in the
path, the order of the schemas in the path is used to resolve this
match. The function path is established by means of the FUNCPATH option
on the precompile and bind commands for static SQL. The function path
is set by the SET CURRENT FUNCTION PATH statement for dynamic SQL. The
function path has the following default value:

"SYSIBM","SYSFU N","<ID>"

This applies to both static and dynamic SQL, where <ID> represents the
current statement authorization ID.

Also, perhaps you can try prefacing the function name with "sysfun.".
If that works you know you have a function path issue.
Regards,
Richard McCutcheon.

Jan 19 '06 #7
Still getting -440 SQLCODE. SELECT SYSFUN.DAYNAME( CURRENT DATE) FROM
SYSIBM.SYSDUMMY 1.

My confusion is more because DAYOFWEEK is working without having to
qualify. This function also has schema SYSFUN like DAYNAME.

Jan 19 '06 #8
Have you tried your SQL while qualifying the function with a schema?

ex/ db2 "select sysfun.dayname( current date) from sysibm.sysdummy 1"
Also, here is the blurb on function path from the v7 info centre.

Function Path
The concept of function path is central to DB2's resolution of
unqualified references that occur when you do not use the schema-name.
For the use of function path in DDL statements that refer to functions,
refer to the SQL Reference. The function path is an ordered list of
schema names. It provides a set of schemas for resolving unqualified
function references to UDFs and methods as well as UDTs. In cases where
a function reference matches functions in more than one schema in the
path, the order of the schemas in the path is used to resolve this
match. The function path is established by means of the FUNCPATH option
on the precompile and bind commands for static SQL. The function path
is set by the SET CURRENT FUNCTION PATH statement for dynamic SQL. The
function path has the following default value:

"SYSIBM","SYSFU N","<ID>"

This applies to both static and dynamic SQL, where <ID> represents the
current statement authorization ID.
Hope this helps point you in the right direction.

Regards,
Richard McCutcheon.

Jan 19 '06 #9
singlal wrote:
Still getting -440 SQLCODE. SELECT SYSFUN.DAYNAME( CURRENT DATE) FROM
SYSIBM.SYSDUMMY 1.

My confusion is more because DAYOFWEEK is working without having to
qualify. This function also has schema SYSFUN like DAYNAME.


Then have a look at the SYSCAT.FUNCTION S catalog view to see if there is a
DAYNAME function listed. If it isn't, I'd suspect that either (a) the V7
manual is not correct about the existence of the function, or (b) something
is garbled in your database.

And if the function exists in the catalog, check its parameters (I believe
SYSCAT.FUNCTION PARMS or something like that). It should have two
parameters: one input (ordinal = 1) and one output (ordinal = 0) with the
data types DATE and VARCHAR, respectively. If you find all the catalog
entries, then something in your system is not as it should be, which leads
me back to the question if someone changed the system clock on the machine.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Jan 20 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1578
by: Bill | last post by:
I created a very simple DB with several forms and tables in chinese version of Access XP running in Chinese Win XP. Now I try to run the same DB in English version of Access XP running in English Win XP. The DB opens just find excpet all buttons or event on froms I click or do it gives me the following error. ______________ The expression On Click you entered as the event property setting produced the following error: A problem...
3
4326
by: TeekUS | last post by:
hey ppl, i am currently developing a parsing application my input is a 10MB english text file the parsing works fine however every now and then a non english character appears that messes everything up. i need to get rid of all these characters before i parse.HELP! Teekus (P.S. i used Regex.Replace but that did not take out the non english characters!) *** Sent via Developersdex http://www.developersdex.com ***
14
2984
by: Gidi | last post by:
Hi, For the last week, i'm looking for a way to make a TextBox always write in English (No matter what the OS default language is). i asked here few times but the answers i got didn't help me. i search in google and found a way with changing the CultureInfo but still didn't work on a TextBox. i'm sure there's a way to do that, but i don't know what's the way. I'm desperate, if some one knows the answer, i will be very thankful to know...
3
1972
by: Karunakararao | last post by:
Hi All DateTime populaing based on regional settings In ASP.NET Application Iam using this Code: Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(HttpContext.Current.Request.UserLanguages); Thread.CurrentThread.CurrentUICulture = new CultureInfo(HttpContext.Current.Request.UserLanguages);
2
2417
by: Scott M. Lyon | last post by:
I'm having some strange problems with a VB.NET application that I support. The application currently uses SystemInformation.UserName() and SystemInformation.UserDomainName() to determine who is logged in, and what network domain they are logged into. And for our environment here (logged into a domain), it seems to work just fine.
20
27799
by: Shawnk | last post by:
I would like to get the class INSTANCE name (not type name) of an 'object'. I can get the object (l_obj_ref.GetType()) and then get the (l_obj_typ.Name) for the class name. I there any way of getting 'l_Fred_my_ins' out of the following. .... My_cls l_Fred_my_ins = new My_cls();
1
3245
by: jackal_on_work | last post by:
Hi, I have a database and want to store data in Spanish and English. To accompish this: 1. Do i need to create separate tables for both the languages like items_en and items_sp? 2. If I opt for the UTF16 charset what single collation setting can I use?
7
3343
by: The Bicycling Guitarist | last post by:
If I have a foreign word, name or phrase in one of my pages, I use the lang attribute to specify the relevant language, e.g., <span lang="de">Manfred von Richthofen</span>. But what if I want to say something like "Richthofen's Circus"? I don't have a screen reader installed, but I try to make my site as accessible as possible. I also try to use as much structural markup as possible. I don't know how a screen reader would voice <span...
4
3314
by: jeet | last post by:
Plz help me.Problem is that On the first page I display all other user with checkbox and give user option to select only two user which he wants to send message. Tell me please how I'll get those checkboxes value and name on the next page and send message to only those two selected user. Thanx in advance
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10404
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10136
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9016
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6765
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3695
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2906
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.