473,732 Members | 2,083 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I get only USA Date format in CLP! What to do to get local format?

I use DB2 8.1 with FixPack 5. In command line for sql I get all DATE
columns only in MM-DD-YYYY format. Of course, DATE('20-12-2003') gives
me an error
SQL0181N The string representation of a datetime value is out of
range.
SQLSTATE=22007

My db config is:

Database territory = RU
Database code page = 1251
Database code set = 1251
Database country/region code = 7

How to get dates in local format?
Nov 12 '05 #1
2 6969
Here is a basic script you can play with. (no error handling, no force user,
no quiesce, ...)

This should change date/time formats for all users using the clp packages
you're binding.

Change the set commands and modify it to your needs.

DATETIME LOC Use the date and time format in local form associated with
the territory code of the database.
REM RUN FROM DB2 COMMAND WINDOW

CLS

REM DATETIME DEF EUR ISO JIS LOC USA

REM 0 = Format associated with the territory code of the client

REM 1 = USA date and time

REM 2 = EUR date, EUR time

REM 3 = ISO date, ISO time

REM 4 = JIS date, JIS time

REM 5 = LOCAL date, LOCAL time

REM -- DATABASE

SET DB=SAMPLE

REM -- USER FOR EXECUTING BIND STATEMENTS

SET BINDUSER=

SET BINDUSING=

REM -- USER FOR EXECUTING TEST SQL STATEMENTS

SET DBUSER=

SET DBUSING=

REM --

SET BND01DATETIME=D EF

SET BND02DATETIME=L OC

SET BND03DATETIME=I SO

PUSHD %DB2PATH%\BND

DB2 CONNECT RESET

DB2 TERMINATE

DB2 CONNECT TO %DB% USER %BINDUSER% USING %BINDUSING%

FOR /F "TOKENS=1 DELIMS=+ " %I IN ('DIR DB2clp*.bnd /B') DO DB2 BIND %I
ACTION REPLACE BLOCKING ALL DATETIME %BND01DATETIME% DEGREE ANY DYNAMICRULES
RUN INSERT BUF SQLERROR CONTINUE

DB2 COMMIT

DB2 TERMINATE

DB2 CONNECT TO %DB% USER %DBUSER% USING %DBUSING%

DB2 LIST PACKAGES FOR ALL | FINDSTR /I "PACKAGE --- SQLC2E03"

DB2 VALUES CURRENT DATE

POPD

PUSHD %DB2PATH%\BND

DB2 CONNECT RESET

DB2 TERMINATE

DB2 CONNECT TO %DB% USER %BINDUSER% USING %BINDUSING%

FOR /F "TOKENS=1 DELIMS=+ " %I IN ('DIR DB2clp*.bnd /B') DO DB2 BIND %I
ACTION REPLACE BLOCKING ALL DATETIME %BND02DATETIME% DEGREE ANY DYNAMICRULES
RUN INSERT BUF SQLERROR CONTINUE

DB2 COMMIT

DB2 TERMINATE

DB2 CONNECT TO %DB% USER %DBUSER% USING %DBUSING%

DB2 LIST PACKAGES FOR ALL | FINDSTR /I "PACKAGE --- SQLC2E03"

DB2 VALUES CURRENT DATE

POPD

PUSHD %DB2PATH%\BND

DB2 CONNECT RESET

DB2 TERMINATE

DB2 CONNECT TO %DB% USER %BINDUSER% USING %BINDUSING%

FOR /F "TOKENS=1 DELIMS=+ " %I IN ('DIR DB2clp*.bnd /B') DO DB2 BIND %I
ACTION REPLACE BLOCKING ALL DATETIME %BND03DATETIME% DEGREE ANY DYNAMICRULES
RUN INSERT BUF SQLERROR CONTINUE

DB2 COMMIT

DB2 TERMINATE

DB2 CONNECT TO %DB% USER %DBUSER% USING %DBUSING%

DB2 LIST PACKAGES FOR ALL | FINDSTR /I "PACKAGE --- SQLC2E03"

DB2 VALUES CURRENT DATE

POPD

PM

"Tatiana Zadiraka" <ta*@aleksin.tu la.net> a écrit dans le message de
news:86******** *************** **@posting.goog le.com...
I use DB2 8.1 with FixPack 5. In command line for sql I get all DATE
columns only in MM-DD-YYYY format. Of course, DATE('20-12-2003') gives
me an error
SQL0181N The string representation of a datetime value is out of
range.
SQLSTATE=22007

My db config is:

Database territory = RU
Database code page = 1251
Database code set = 1251
Database country/region code = 7

How to get dates in local format?

Nov 12 '05 #2
I made the same and got
db2 => VALUES current date

1
----------
03-07-2004

db2 => VALUES date('20-12-2003')
SQL0181N The string representation of a datetime value is out of range.
SQLSTATE=22007

Any comments on that?

Tatiana
Nov 12 '05 #3

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

Similar topics

7
7391
by: James Foreman | last post by:
We have 5 users of our database (DB2 UDB 8.1 on SuSE linux) : db2inst1 bill fred sarah jessica The tables are created under db2inst1, which has the ability to drop/create/alter/etc. bill, fred, sarah and jessica all have select
5
9554
by: Frank Apap | last post by:
I am trying to call a stored procedure that has an INOUT parameter from the CLP to do some testing on a UDB 8 system. Since the value is needed as input I cannot use ? for the parameter, and when I put the value in directly, eg. call sproc_test('1234') gives me a SQL0469N error. I'm pretty sure I was able to do this once before by declaring a variable in the CLP before making the call; but I can't remember how.
1
2225
by: hrishy | last post by:
Hi DB2-experts How do i invoke the db2 clp form the dos prompt on windows..do i need to set some environment varaiables. regards Hrishy
1
3942
by: Raquel | last post by:
How do I perform a SET CURRENT SQLID in CLP and also, is there any command I can give on the CLP to know what my CURRENT SQLID is? When I issue: db2 set current sqlid='db2admin' It says the command executed successfully, but it seems that when I execute any further command on CLP (like db2 select * from table), it is not using db2admin (the SQLID that I set). TIA
3
2473
by: Gustavo Randich | last post by:
Hello, Is there a way to revalidate (rebind) all inoperative packages (SYSCAT.PACKAGES.VALID = 'X') via a stored procedure that scans invalid packages from SYSCAT.PACKAGES and execute the CLP command REBIND or something similar? I need this because db2rbind doesn't fix inoperative ('X') packages, and I need a script runnable from SQL console (NOT CLP console!) which fixes all of them at once.
0
1165
by: Pablo Silva O | last post by:
Hi! I'm very new user with DB2, I would like a simple example of howto make a cursor by script in db2. I know howto make a cursor in Oracle, but howto make script in CLP, that I can execute as script?, it's necesary make a client program (for example with java) for this?, or I can make a simple script with notepad and execute in CLP?
2
4166
by: Erik Hendrix | last post by:
Hi, When I run a DB2 command: i.e.: db2 list tablespaces show detail and while this is running do: ps -ef | grep "db2 " then I can see in the output the db2 command as: db2 list tablespaces show detail
38
3059
by: sopranos2 | last post by:
Dear IBM DB2 support, I wish CLP would have been more functional. Without living the command line I would like to get sql return code explanations, scalar function definitions etc.. Looking forward to see CLP enhancements in v8.3 -mike
4
1957
by: bea | last post by:
Is there a way to set a default schema name by setting environment variable, so that it is set for CLP before connect to the database? Thank you.
9
4715
by: Frank Swarbrick | last post by:
I've probably asked this before, but I can't remember the answer! One can use the DECIMAL function to convert a date to a decimal. For instance values decimal(current_date) returns 20080528. Is there an easy way to convert the decimal value back to a date? I can't use DATE(<decimal-value>) because it expects the decimal value to be the number of days since Jan 1, 0001.
0
8944
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8773
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
9445
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
9234
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
9180
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
8186
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
6733
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
4805
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2177
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.