If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > date formats

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-25-06, 05:29
raavi raavi is offline
Registered User
 
Join Date: Aug 2006
Posts: 18
date formats

my question


i am new to db2.i want date formats in db2(diffrent date formats) and how to execute those formats?
Reply With Quote
  #2 (permalink)  
Old 08-25-06, 08:36
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Can you be more specific. Also please state your OS and DB2 version.
Andy
Reply With Quote
  #3 (permalink)  
Old 08-28-06, 04:16
raavi raavi is offline
Registered User
 
Join Date: Aug 2006
Posts: 18
date formats in db2

my question


in oracle we are using date formate dd-mm-yy in this way .in db2 any equivalent formats are there.in diffrent ways....
Reply With Quote
  #4 (permalink)  
Old 08-28-06, 06:07
rahul_s80 rahul_s80 is offline
Registered User
 
Join Date: Jul 2006
Location: Pune , India
Posts: 433
C:\Program Files\IBM\SQLLIB\BIN>db2 values(char(current date,iso))
2006-08-28

C:\Program Files\IBM\SQLLIB\BIN>db2 values(char(current date,eur))
28.08.2006

C:\Program Files\IBM\SQLLIB\BIN>db2 values(char(current date,usa))
08/28/2006

C:\Program Files\IBM\SQLLIB\BIN>db2 values(char(current date,local))
08-28-2006

C:\Program Files\IBM\SQLLIB\BIN>db2 values(char(current date,jis))
2006-08-28

ypu can further use substr function to edit the o/p
Reply With Quote
  #5 (permalink)  
Old 08-28-06, 07:24
raavi raavi is offline
Registered User
 
Join Date: Aug 2006
Posts: 18
concatnation

my question

in oracle we are using concatnation symbol(||) per seperating two lines or combinding two lines .in db2 any equivalent is there.....
Reply With Quote
  #6 (permalink)  
Old 08-28-06, 07:27
raavi raavi is offline
Registered User
 
Join Date: Aug 2006
Posts: 18
[QUOTE=raavi]my question

in oracle we are using concatnation symbol(||) per seperating two lines or combinding two lines .in db2 any equivalent symbol is there.....
Reply With Quote
  #7 (permalink)  
Old 08-28-06, 11:29
rahul_s80 rahul_s80 is offline
Registered User
 
Join Date: Jul 2006
Location: Pune , India
Posts: 433
db2 => select 'Rahul' || 'Singh' from sysibm.sysdummy1

1
----------
RahulSingh

but it is giving error on db2 clp ? dont know why..
neways you can also use concat scalar function
Reply With Quote
  #8 (permalink)  
Old 08-29-06, 00:37
raavi raavi is offline
Registered User
 
Join Date: Aug 2006
Posts: 18
my question




what is a package in db2 and structure of package.what is the use of package.give some examples.
Reply With Quote
  #9 (permalink)  
Old 08-29-06, 01:57
raavi raavi is offline
Registered User
 
Join Date: Aug 2006
Posts: 18
in oracle we are using NVL function .any equivalent functuion is there in db2.(with example).
Reply With Quote
  #10 (permalink)  
Old 08-29-06, 03:45
rahul_s80 rahul_s80 is offline
Registered User
 
Join Date: Jul 2006
Location: Pune , India
Posts: 433
hey Ravi
why dont you brush up your db2 basic from a free cook book available on net.
DB2 UDB V8.2
SQL Cookbook
Graeme Birchall. search on google
neways ans. is coalesce function

--Rahul Singh
Reply With Quote
  #11 (permalink)  
Old 09-04-06, 01:47
raavi raavi is offline
Registered User
 
Join Date: Aug 2006
Posts: 18
Hi,

How To Write Stored Procedure In Db2 And Syntax Of Stored Procedure.
Reply With Quote
  #12 (permalink)  
Old 09-04-06, 02:38
Peter.Vanroose Peter.Vanroose is offline
Registered User
 
Join Date: Sep 2004
Location: Belgium
Posts: 1,079
google is your friend:
http://www.google.com/search?q=DB2+%...ite%3A.ibm.com

More specifically, see http://publib.boulder.ibm.com/infoce...n/r0008329.htm
(but maybe you are on a different platform or DB2 version).

P.S.: it's better to start a new thread in this forum if you have a new question!
__________________
--_Peter Vanroose,
__IBM Certified Database Administrator, DB2 9 for z/OS
__IBM Certified Application Developer
__ABIS Training and Consulting
__http://www.abis.be/
Reply With Quote
  #13 (permalink)  
Old 09-13-06, 05:04
raavi raavi is offline
Registered User
 
Join Date: Aug 2006
Posts: 18
in sql server we are using @@identity key word any equivalent key word is there in db2 and how many types of key words are there in db2.
Reply With Quote
  #14 (permalink)  
Old 09-13-06, 08:08
grofaty grofaty is offline
Registered User
 
Join Date: Jan 2003
Posts: 1,570
Quote:
Originally Posted by rahul_s80
db2 => select 'Rahul' || 'Singh' from sysibm.sysdummy1

1
----------
RahulSingh

but it is giving error on db2 clp ? dont know why..
neways you can also use concat scalar function
The | simbol is operating system command. If you would like to use operating system commands like |, > or < you need to specifiy double quotes before and after the command so:

db2 "select 'Rahul' || 'Singh' from sysibm.sysdummy1"

Another way is to use CONCAT statement:
db2 select 'Rahul' CONCAT 'Singh' from sysibm.sysdummy1

Another way is to use CONCAT function:
db2 select CONCAT('Rahul', 'Singh') from sysibm.sysdummy1

I prefere using CONCAT as statement because it is the most readiable one.
Reply With Quote
  #15 (permalink)  
Old 09-13-06, 08:11
grofaty grofaty is offline
Registered User
 
Join Date: Jan 2003
Posts: 1,570
Quote:
Originally Posted by raavi
in oracle we are using NVL function .any equivalent functuion is there in db2.(with example).
NVL function is Oracle specific, COALESCE function is SQL standard. So use COALESCE instread of NVL for multidatabase support.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On