Solved

Changing the Primary Key Index SQL Compact 3.5

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

895 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

17 Experts available now in Live!

Get 1:1 Help Now