0
CREATE TABLE "Customer" (
  "Id" integer primary key autoincrement not null,
  "Name" varchar,
  "Mid" varchar,
  "Year" integer,
  "Semester" integer 
)

+----+---------+-----+------+----------+    
| Id | Name    | Mid | Year | Semester |
+----+---------+-----+------+----------+
| 13 | sampath | 44  | 4    | 1        |
| 14 | vijay   | 12  | 4    | 2        |
| 15 | john    | 13  | 4    | 2        |
| 16 | mary    | 14  | 4    | 2        |
+----+---------+-----+------+----------+

I have two questions:

  1. How can I use the previously deleted id value to new record. In sqlite we don't have identity column so I used the autoincrement keyword. Can I use set identity_insert here?

  2. Is there any possibility of using DBCC to reset id values?

Andrew LaPrise
  • 3,373
  • 4
  • 32
  • 50
  • "How can I use the previously deleted id value to new record." What are you asking? Are you saying you deleted a record but don't remember the id that you used when deleting it? SQLite has a last insert rowid. http://www.sqlite.org/c3ref/last_insert_rowid.html – Robert Dupuy Sep 19 '15 at 20:23
  • i have deleted a record with id =5 for example and when i inserted a new record then i get id=10 now how to replace the gap for id =5 @RobertDupuy – Sai Sampath Sep 20 '15 at 15:45
  • http://stackoverflow.com/questions/3122865/how-to-reseed-an-an-auto-increment-column-in-a-sqlite-database – Robert Dupuy Sep 20 '15 at 16:03

0 Answers0