Primary key Autoincrement

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Primary key Autoincrement

tkellerer

gunitinug wrote:

> In netbeans ide
>
>
> Code:
>
> CLIENTS table
> ----------------
> CLIENTID
> CLIENTNAME
>
>
>
>
> Here I want CLIENTID to be primary key and autoincrement. How to do so?
>
> I want CLIENTID to be auto populated when adding a new record via web page.
This is not really a NetBeans question - this is a general Java/database programming question.

But the really important part is missing: which DBMS are you using?




Reply | Threaded
Open this post in threaded view
|

Primary key Autoincrement

tkellerer

priya465 wrote:
> If the table is already populated it is not possible to change a column to IDENTITY column or convert it to non IDENTITY column. You would need to export all the data out then you can change column type to IDENTITY or vice versa and then import data back. I know it is painful process but I believe there is no alternative except for using sequence as mentioned in this post.
This depends completely on the DBMS. With Postgres or Oracle this would be easily possible.