Results 1 to 6 of 6
  1. #1
    Join Date
    May 2012
    Posts
    2

    Unanswered: Creating Tables In Run Time

    Hi,
    Can any one suggest me how can i create tables at run time based on the metadata.

    Thanks in Advance

  2. #2
    Join Date
    Apr 2012
    Posts
    1,035
    Provided Answers: 18
    Always post your DB2 version and fixpack, and client and server operating system names.

    Do you want to explain your question properly?
    Or is there something about 'create table' in dynamic-SQL that's unclear ?

  3. #3
    Join Date
    May 2012
    Posts
    2
    In general irrespective of database, my question is i need to load a file in to the table ..the table needs to be created based on the structure of the file

  4. #4
    Join Date
    Oct 2009
    Location
    221B Baker St.
    Posts
    486

    creating tables in run time

    What do you mean by "the metadata"?

    How do you intend to generate the CREATE TABLE syntax on the fly?

    If you more completely explain exactly what you are trying to do, someone may have a suggestion.

  5. #5
    Join Date
    Jul 2009
    Location
    NY
    Posts
    963
    Simply use the Dynamic SQL for this.
    If you have an authority to create table you can do it dynamically.
    You can prepare statement and Execute, or Execute Immediate.

    Lenny

  6. #6
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    If you are using DB2 LUW and EXPORT the data using IXF format, and then use IMPORT with REPLACE_CREATE option, the table will be created if it does not already exist. Note that this feature has been depricated and may be removed in a future release (not sure what replaces it).
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

Posting Permissions

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