User Profile

Collapse

Profile Sidebar

Collapse
docdiesel
docdiesel
Joined: Aug 10 '07
Location: Munich
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • docdiesel
    replied to Data export from db2
    in DB2
    Hi,

    I dont' know much about importing to M$-SQL, but for the export you should try "OF DEL". This produces delimited data where default column delimiter is a comma (,) and strings are delimited with a double quotation mark ("). This should be usable as csv file.

    If needed you may change the delimiters with the modifiers coldel and chardel. Find more information here at the IBM site.

    Regards...
    See more | Go to post

    Leave a comment:


  • docdiesel
    replied to Difference in record counts
    in DB2
    Hi,

    you posted the same sql stametent two times. I guess this is copy-and-paste related and the 2nd one should be

    Code:
    select count(*) from A where TXN_DATE>'20/06/2007'
    The difference is 208419 rows. Is the column TXN_DATE nullable? Try the following:

    Code:
    select count(*) from A where TXN_DATE is NULL
    select count(*) from A where TXN_DATE>'1900-01-01'
    Based upon...
    See more | Go to post

    Leave a comment:


  • Hi,

    if there's a primary key on your table (e.g. column "id") or another indexed field, then use this by COUNT(ID) instead of COUNT(*).

    The latter one means that DB2 has to do a complete table scan, resulting in lots of i/o and consuming much more time that using an indexed column.

    Regards


    Doc
    See more | Go to post

    Leave a comment:


  • docdiesel
    replied to Updating only the year in a date
    in DB2
    Hi,

    in sql you've got to update the field, not a functions result of a field.

    The where clause is ok, but you've got to assemble the set instruction with string concatenation, like

    set datecolname = date( concat( year(datecol)+1 900, "-", month(datecol), "-", day(datecol) ) )

    which does not handle the days and month <10 yet.

    Regards

    Doc Diesel
    See more | Go to post

    Leave a comment:


  • Hi,

    that won't do. The string must be in one of the following formats:
    • "2009-06-25-16.12.30.000000 "
    • "2009-06-25"
    • "25-06-2009"

    Try to chop and rearrange the string by using substr() and maybe replace() for the month' name.

    Regards


    Doc
    See more | Go to post

    Leave a comment:


  • docdiesel
    replied to Database creation failing on AIX.
    in DB2
    Hi,

    make sure that the DB2 Admin Server is up and running. You may also have a look with netstat what ports are open. There should be two lines like this:
    Code:
    tcp  0  0  0.0.0.0:523    0.0.0.0:*  LISTEN  1234/db2dasrrm
    tcp  0  0  0.0.0.0:50000  0.0.0.0:*  LISTEN  2345/db2sysc
    If port 523 isn't open, logon as DB2 admin user (db2as or db2adm, depends) and start the administration server (db2admin start).
    ...
    See more | Go to post

    Leave a comment:


  • docdiesel
    replied to SQL0284N error
    in DB2
    Hi,



    As far as I can see you're having two alternatives: Use a different, new created regular tablespace ("IN_MY_NAME_RE GULAR") or ask someone who may change the setup of the large tablespace.

    Regards


    Doc Diesel...
    See more | Go to post

    Leave a comment:


  • docdiesel
    replied to restore database
    in DB2
    Hi,

    if you've got no manual in printed form, you may use IBMs online reference to the DB2 restore command. If you still have problems, then please tell us about your setup (OS, DB2 version) and what commands you tried so far.

    Regards


    Doc Diesel
    See more | Go to post

    Leave a comment:


  • docdiesel
    replied to plz help- query related to DB2
    in DB2
    Hi,

    user your SELECT including the ORDER BY statement to create a VIEW, and then insert into the destination table reading from there:

    Code:
    INSERT INTO
      DESTTABLE
    SELECT
      name, no
    FROM
      MYVIEW ;
    Regards

    Doc Diesel
    See more | Go to post

    Leave a comment:


  • Catalog windows Db2 on AIX

    Hi,

    the AIX server won't be able to connect to your Windows PC if you use its IP address to catalog the node while the IP always changes every morning when you start it.
    • Catalog your windows PC as node based on its DNS entry.
    • If DNS isn't an option, use an entry in /etc/hosts of your AIX system. You'll have to update it every time when DHCP gives your PC another IP.
    • Make sure
    ...
    See more | Go to post

    Leave a comment:


  • docdiesel
    replied to SQL0284N error
    in DB2
    Hi,

    my guess is that you created the tablespace IN_MY_NAME with default parameters, and your're using DB2 v9. In this version the default for most tablespaces is "large tablespace". Try to recreate it as "regular" tablespace. (See also IBM documentation for "create tablespace".)

    Regards


    Doc Diesel
    See more | Go to post

    Leave a comment:


  • docdiesel
    replied to SQL30081N error
    in DB2
    Hi,

    what exactly do you try to do when you get the SQL30081N error? Do you try to connect from WinXP_A to a database on WinXP_B ? Did you catalog the remote database on client side (=WinXP_A)?

    For checking the TCP/IP connection try a "telnet WinXP_B_ip 50000" on your WinXP_A machine.

    Regards


    Doc Diesel
    See more | Go to post

    Leave a comment:


  • Hi,

    if you're working with Windows on both sides, then the protocol used is SMB/CIFS, means NFS has nothing to do with this.

    One point may be that the DB2 process is using different users than yours (e.g. db2inst1 for the instance and db2fenc1 for stored procedures). Make sure they have access to the remote files, too, not only your user.

    The other thing is that the mapped drive letter may not be visible...
    See more | Go to post

    Leave a comment:


  • docdiesel
    replied to DB2 Bulk Load via Java/JDBC
    in DB2
    Hi,

    I'm sorry to say so but LOAD won't work through JDBC. It no SQL but a CLI command which will be accepted by the DB2 command line interface only.

    Regards

    Doc Diesel
    See more | Go to post

    Leave a comment:


  • Hi,

    I guess you checked the file access permissions on the remote file? What OS and filesystems are you using on your DB2 server and the remote file server? Is the remote file system mounted via NFS or Samba/CIFS?

    If it's NFS and you mounted it by TCP, then try using UDP and let us know if this helped. (I once experienced that DB2 doesn't like LOAD from TCP NFS filesystems.)

    Best regards

    ...
    See more | Go to post

    Leave a comment:


  • docdiesel
    replied to DB2 V8 String Parsing Question
    in DB2
    Hi,

    you may use the REPLACE() function of DB2 (see also IBM DB2 Infocenter). I guess you'll have to escape the LF character as CHAR(10), or if it's text from a Windows system CHAR(10*256+13) .

    Regards

    Doc Diesel
    See more | Go to post

    Leave a comment:


  • docdiesel
    replied to how to find middle row of a table?
    in DB2
    Hi,

    there's a ROW_NUMBER() OVER() functionality in DB2. You could create a view containing this function, e.g.:
    Code:
    Create View
      schema.v_numbered
    as
      Select
        ROW_NUMBER() OVER() as ROWNO,
        id,and,other,columns
      From
        schema.mytable ;
    and then search for the row no. ( count(rows) DIV 2 ).

    Regards

    Doc Diesel
    See more | Go to post

    Leave a comment:


  • docdiesel
    replied to Row_number() over() not working in SPUFI
    in DB2
    Hi Karen,

    I'm sorry, but ROW_NUMBER() OVER() isn't supported in DB2 v8 for z/OS. While it's included in v8 for Linux, Unix and Windows, for z/OS it's been introduced with v9. See also the IBM Redbook "DB2 9 for z/OS Technical Overview", p. 19:

    Data warehousing and reporting
    * SQL enhancements
    - EXCEPT and INTERSECT,
    - OLAP specifications: RANK, DENSE_RANK, ROW_NUMBER
    - Cultural sort...
    See more | Go to post

    Leave a comment:


  • docdiesel
    replied to shell script to extract rows from table
    in DB2
    Hi,

    either you use "db2 -x SELECT ..." to suppress the header & footer, or you grep for the leading digit "2" (of 2008...):
    Code:
    db2 "SELECT ... " | grep ^2 >file.txt
    Instead of that you may store the date in a shell variable and use the latter in the next step:
    Code:
    DTSTAMP=` db2 -x "select ..." `
    db2 "select * ... where WHERE TIMESTAMP_UPDATED > '$DTSTAMP' "
    ...
    See more | Go to post

    Leave a comment:


  • docdiesel
    replied to shell script to extract rows from table
    in DB2
    Hi,

    Code:
    db2 "select a,b,c from schema.mytable" >file.txt
    should do, if you don't need the data in CSV format. Use "db2 -x" if you don't want the column heads.

    Regards

    Doc Diesel
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...