ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Create Table

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Create Table

    Is there a way to create a table with unique members?

    Something like...

    Exec Sql
    Create Table MyLib/XX_TEST MBR('XX123')
    (Fld1 Char(3)
    Fld2 Numeric(3,0));

  • #2
    AFAIK, SQL does not support the multi-member construct, so you will not be able to create or alter tables that way. It can use an existing multi-member file by first creating an alias for the member, then have SQL reference the member. If you are moving to SQL, you will want to avoid multi-member files. I suppose you could build the file with DDS, then use that method, but is it work it?

    Comment


    • #3
      SQL will only support partitioned tables (which are kind of multi member files), but for using it on the i you'll need SMP which is an extra charged feature.
      Question is why do you need multiple member files?
      I'm working now for more than 25 years on the i and its predecessors and had never any need to create multiple member files.
      Even in environments where we worked with different (independent) companies.

      Birgitta

      Comment


      • #4
        If you want same table name with different definitions, use different schemas (libraries).

        Comment


        • #5
          If you have DDS files with multiple members and you're just trying to access individual members you do it using the CREATE ALIAS

          CREATE ALIAS MYLIB.XX_TEST_M123 FOR MYLIB/XX_TEST (XX123)
          CREATE ALIAS MYLIB.XX_TEST_M124 FOR MYLIB/XX_TEST (XX124)

          Then you use MYLIB/XX_TEST_M123 in your SQL statements (SELECT * FROM MYLIB.XX_TEST_M123 gets data from the first member).

          Comment

          Working...
          X