Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. DB2: Create primary key on partition table?

DB2: Create primary key on partition table?

Scheduled Pinned Locked Moved Database
questioncsharpmcpcryptographytutorial
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cuong nm
    wrote on last edited by
    #1

    Hi all ! In DB2, I want to create primary key on partition table. How can I do it? Example: Create table TEMP1: CREATE TABLE TEMP1 ( ID INTEGER NOT NULL, DATEREPORT VARCHAR(8) NOT NULL, NUMBERREPORT VARCHAR(20), TITLE VARCHAR, YEAR INTEGER, IDCOM INTEGER, IDTEN INTEGER DEFAULT 0 NOT NULL )DISTRIBUTE BY HASH (IDTEN, YEAR); After that, I want to create primary key on ID column but not yet. How can I do? Thanks !

    MCP.NET, MCAD.NET, MCSD.NET

    H W 2 Replies Last reply
    0
    • C cuong nm

      Hi all ! In DB2, I want to create primary key on partition table. How can I do it? Example: Create table TEMP1: CREATE TABLE TEMP1 ( ID INTEGER NOT NULL, DATEREPORT VARCHAR(8) NOT NULL, NUMBERREPORT VARCHAR(20), TITLE VARCHAR, YEAR INTEGER, IDCOM INTEGER, IDTEN INTEGER DEFAULT 0 NOT NULL )DISTRIBUTE BY HASH (IDTEN, YEAR); After that, I want to create primary key on ID column but not yet. How can I do? Thanks !

      MCP.NET, MCAD.NET, MCSD.NET

      H Offline
      H Offline
      Herman T Instance
      wrote on last edited by
      #2

      use google: http://sqlzoo.net/howto/source/z.dir/tip241027/i02create.xml[^]

      In Word you can only store 2 bytes. That is why I use Writer.

      C 1 Reply Last reply
      0
      • H Herman T Instance

        use google: http://sqlzoo.net/howto/source/z.dir/tip241027/i02create.xml[^]

        In Word you can only store 2 bytes. That is why I use Writer.

        C Offline
        C Offline
        cuong nm
        wrote on last edited by
        #3

        Sorry, do you understand my question? You must run by step: - Create table with partition by hash - Create PK on that table or - Create table with PK and partition by hash will have same error SQL0270N Function not supported Reason code = "1")

        MCP.NET, MCAD.NET, MCSD.NET

        1 Reply Last reply
        0
        • C cuong nm

          Hi all ! In DB2, I want to create primary key on partition table. How can I do it? Example: Create table TEMP1: CREATE TABLE TEMP1 ( ID INTEGER NOT NULL, DATEREPORT VARCHAR(8) NOT NULL, NUMBERREPORT VARCHAR(20), TITLE VARCHAR, YEAR INTEGER, IDCOM INTEGER, IDTEN INTEGER DEFAULT 0 NOT NULL )DISTRIBUTE BY HASH (IDTEN, YEAR); After that, I want to create primary key on ID column but not yet. How can I do? Thanks !

          MCP.NET, MCAD.NET, MCSD.NET

          W Offline
          W Offline
          Wendelius
          wrote on last edited by
          #4

          As far as I know you cannot create a primary key without including all the columns in distribute list. So basically you either have to: - include ID in the distribute list - define the primary key using IDTEN and YEAR and ID

          The need to optimize rises from a bad design.My articles[^]

          C 1 Reply Last reply
          0
          • W Wendelius

            As far as I know you cannot create a primary key without including all the columns in distribute list. So basically you either have to: - include ID in the distribute list - define the primary key using IDTEN and YEAR and ID

            The need to optimize rises from a bad design.My articles[^]

            C Offline
            C Offline
            cuong nm
            wrote on last edited by
            #5

            ok, thanks

            MCP.NET, MCAD.NET, MCSD.NET

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups