Solved

Changing the Primary Key Index SQL Compact 3.5

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

730 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