Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Changing the Primary Key Index SQL Compact 3.5

Posted on 2012-04-01
3
643 Views
Last Modified: 2012-09-02
I have a small SQL CE 3.6 *.SDF Database File which contains 3 tables.
I noticed there is an error on one of the tables. The primary key index starts at 1 but I need it to be 0. How can I change this without recreating the table?
0
Comment
Question by:soulhero
3 Comments
 
LVL 42

Accepted Solution

by:
dqmq earned 500 total points
ID: 37794045
I assume it's an identity column, otherwise a simple sql update statement would suffice.  Though, I must say, if it's a clustered index even the simple sql update would amount to a rebuild of the entire table.  So, I'm not sure why you are avoiding the re-create.  

I'm also a little confused by the notion of using identity (which implies no business meaning) and then insisting on a seed starting with 0 (which implies the opposite).  If you are feeling a need to control the values assigned to your PK, then perhaps idenitity is not such a good idea.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question