title: Altering my primary key to auto increment - JavaDB
body: <p>I am using Netbeans, writing in Java and using Derby.</p>
  
  <p>I have a table within APP called PERSON. Within PERSON I have a column called PID with the following properties:</p>
  
  <pre><code>Name: PID
  Nulls allowed: [ ]
  Data type: NUMERIC
  Column size: 4
  Decimal digits: 0
  Position: 1
  Part of a primary key: [/]
  Part of an index: [/]
  </code></pre>
  
  <p>I used the meta data isAutoIncrement function to check if it was already auto incrementing and it is not!</p>
  
  <p>I have since tried using the following SQL commands to alter it:</p>
  
  <p>I believe this may not have been for Derby:</p>
  
  <pre><code>ALTER TABLE APP.PERSON ALTER PID NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY 
  (START WITH 1, INCREMENT BY 1); 
  </code></pre>
  
  <p>Upon checking the Oracle website, I found the correct syntax:</p>
  
  <pre><code>ALTER TABLE APP.PERSON ALTER PID SET INCREMENT BY 1;
  </code></pre>
  
  <p>I even tried leading zeros:</p>
  
  <pre><code>ALTER TABLE APP.PERSON ALTER PID SET INCREMENT BY 0001;
  </code></pre>
  
  <p>None of which have worked, the error I get on the last two are:</p>
  
  <pre><code>ALTER TABLE '"APP"."PERSON"' specified attributes for column 'PID' that are 
  not compatible with the existing column.
  </code></pre>
  
  <p>Any ideas of the correct syntax?</p>