Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: date formats

  1. #1
    Join Date
    Aug 2006
    Posts
    18

    Unanswered: date formats

    my question


    i am new to db2.i want date formats in db2(diffrent date formats) and how to execute those formats?

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Can you be more specific. Also please state your OS and DB2 version.
    Andy

  3. #3
    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....

  4. #4
    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

  5. #5
    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.....

  6. #6
    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.....

  7. #7
    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

  8. #8
    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.

  9. #9
    Join Date
    Aug 2006
    Posts
    18
    in oracle we are using NVL function .any equivalent functuion is there in db2.(with example).

  10. #10
    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

  11. #11
    Join Date
    Aug 2006
    Posts
    18
    Hi,

    How To Write Stored Procedure In Db2 And Syntax Of Stored Procedure.

  12. #12
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    1,126
    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/

  13. #13
    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.

  14. #14
    Join Date
    Jan 2003
    Posts
    1,605
    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.

  15. #15
    Join Date
    Jan 2003
    Posts
    1,605
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •