By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,363 Members | 2,143 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,363 IT Pros & Developers. It's quick & easy.

resetting Identity column values

P: 13
I have a table :
drop table REPORTING_FILES
Create table REPORTING_FILES
(
DRF_FILE_ID INTEGER IDENTITY (1,1) PRIMARY KEY,
DRF_FILE_NAME VARCHAR(50),
DRF_SUBJECT_LINE varchar(50)
)

With entries :
1 abc abc subject
2 xyz xyz subject
3 mnq mnq subject
4 yyz yyz subject

When I delete DRF_FILE_ID=2 , I have entry like
1 abc abc subject
3 mnq mnq subject
4 yyz yyz subject

I would like to have it as :
1 abc abc subject
2 mnq mnq subject
3 yyz yyz subject

How can I achive this?
I have to reset this as by drop down list in .NET applcation uses the Index to display and delete the file, since index 2 is deleted, and not rearranged, its creating a problem.
Thanks.
Apr 10 '08 #1
Share this Question
Share on Google+
1 Reply


ck9663
Expert 2.5K+
P: 2,878
I have a table :
drop table REPORTING_FILES
Create table REPORTING_FILES
(
DRF_FILE_ID INTEGER IDENTITY (1,1) PRIMARY KEY,
DRF_FILE_NAME VARCHAR(50),
DRF_SUBJECT_LINE varchar(50)
)

With entries :
1 abc abc subject
2 xyz xyz subject
3 mnq mnq subject
4 yyz yyz subject

When I delete DRF_FILE_ID=2 , I have entry like
1 abc abc subject
3 mnq mnq subject
4 yyz yyz subject

I would like to have it as :
1 abc abc subject
2 mnq mnq subject
3 yyz yyz subject

How can I achive this?
I have to reset this as by drop down list in .NET applcation uses the Index to display and delete the file, since index 2 is deleted, and not rearranged, its creating a problem.
Thanks.
if there are other relationship that this field is being used for, you're going to reset all of those. If you just want a dynamic row you can generate it dynamically using a sql just like this If you really want this column reset, check it here

-- CK

-- CK
Apr 10 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.