Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2004

    Unanswered: Primary Key in MQT in DB2/Linux


    DB2 v9.7 on Linux.

    I do not see manual saying primary key is not possible on a User Maintained MQT. Yet I am unable to create one. It does not allow it. Has anybody tried it or used PK on MQTs before?

    Thanks in advance!

  2. #2
    Join Date
    Jan 2003
    Provided Answers: 5
    How are you creating the MQT? How are you trying to create the PK? What is the result you are getting?


  3. #3
    Join Date
    May 2003
    MQT's cannot have unique indexes (which are required for a PK). So make sure you create a non-unique index on the MQT for the same columns as the PK if it is needed for performance reasons.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  4. #4
    Join Date
    Apr 2004
    Hi guys, thanks for the response. Marcus, I think we can create unique indexes on MQTs in DB2 luw. Only the primary key constraint can not be created. Although I don't see the book saying so anywhere. In DB2 z/OS though even PK is possible on MQTs. So it is strange that it won't allow PK in LUW. On trying to add a PK or put it in table ddl, it just gives an error like 'xxxx expected' and so on.

  5. #5
    Join Date
    Aug 2008
    If you try to create a unique index - you should see the error SQL0159N - sqlstate 42809. Confirming a unique index cannot be created

Posting Permissions

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