Solved

Changing the Primary Key Index SQL Compact 3.5

Posted on 2012-04-01
3
633 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to shrink a transaction log file down to a reasonable size.

705 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now