Results 1 to 9 of 9
  1. #1
    Join Date
    Sep 2006
    Posts
    6

    Unanswered: db to database creation problem

    hi,
    i have created a database as

    su - db2inst1
    db2
    CREATE DATABASE TEST
    CONECT TO TEST

    now i have to insert data from an sql file named test.sql
    but when i do that using command

    =>IMPORT FROM test.sql OF DEL INSERT INTO TEST
    OR
    =>LOAD FROM test.sql OF DEL INSERT INTO TEST

    I always get an error as

    SQL3304N The Table Does not exist.

    can you help me to find where am i wrong?
    thanks
    bye

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    Exactly what it says - "The Table Does not exist"

    You will have to create the table before you import from a del file ..
    If you are using ixf you will be able to create the table from the source file

    Sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    Sep 2006
    Posts
    6
    actualy what i want is to insert data from that sql file ans its an ascii file

    like create table sample (
    id integer NOT NULL
    keyword varchar(240) NOT NULL
    );

  4. #4
    Join Date
    Jun 2006
    Posts
    471

    insert

    the scenario would be
    su - db2inst1
    db2 create database anyname
    db2 connect to anyname
    db2 create table anytable (col1 char(xx), col2.....
    db2 import from test.dta of del insert into anytable...
    db2 connect reset
    this is all..
    Best Regards, Guy Przytula
    DB2 UDB LUW certified V6/7/8

  5. #5
    Join Date
    Sep 2006
    Posts
    6
    you mean i have to create all tables manually in that sql file?

  6. #6
    Join Date
    Jun 2006
    Posts
    471

    create

    yes
    each table to be filled with data by import has to exist
    as indicated before : only if data was exported with ixf format you can
    db2 import filename of ixf create into tablename
    otherwise : insert into tablename and table should exist.
    Best Regards, Guy Przytula
    DB2 UDB LUW certified V6/7/8

  7. #7
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by lhrt
    you mean i have to create all tables manually in that sql file?
    If your script contains statements like "CREATE TABLE ..." you should run it like this:

    "db2 -tvf yourscriptname.sql"

    and it will create empty tables for you.

    PS See, if you'd shown us your script in the beginning you'd get better answers right away.

  8. #8
    Join Date
    Sep 2006
    Posts
    6
    thanks guys.
    but i can create tables from sql file
    either usinf
    db2 -tvf sample.sql
    or
    db2batch -d sampledatabase -f sample.sql

    but when i tried to insert data to these tables from an sql file
    that shows some error like

    db2 -tvf data.sql throws error input is too long

    db2batch -d sampledatabase -f data.sql gives error Bus error

    by the way im using suse linux with db2 8.1
    bye
    thanks

  9. #9
    Join Date
    Sep 2006
    Posts
    6

    solved

    db2 vf sampledata.sql works. dont use option "t".
    thanks all

Posting Permissions

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