tags:

views:

21

answers:

1

Hi friends,

Now i am working in SQLite database. I want to add primary key from my existing table. But i couldn't add the primary key in existing table and i have deleted all the records in the old table. So how can i add the primary key from existing table in SQLite?

Here my query is,

        alter table studetails add constraint pk primary key (rollno).

I have used that above query, but it shown error. Is it possible?, if yes, please guide me.

Thanks!

+1  A: 

Hi, you cannot according to SQLite's syntax perform this operation. In general it seems strange to add a primary key to an existing table. This should be done using the create table statement (you can also add an index by create index).

Br Anders

Alter table in SQLite
Create table in SQLite

Anders
+1,Thanks for the answer.
Pugal Devan