473,378 Members | 1,360 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

resetting Identity column values

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
1 1048
ck9663
2,878 Expert 2GB
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

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

Similar topics

6
by: Who.Really.Really.Cares | last post by:
Hi! I guess this must be a FAQ but I'll give it a try. I've searched the web and usenet archive and found only negative answers. But most of them were dated like 3-4 years back. Hasn't anything...
4
by: UDBDBA | last post by:
Hi: we have column with GENERATED ALWAYS AS DEFAULT. So, we can insert into this column manually and also let db2 generate a value for this column. Given a scenario, how can i find the NEXTVAL...
3
by: dusty | last post by:
Hi, I'll try to simplify the problem: I created a table "TestTable" in a database on the SQL server. The first column, 'id', is the primary key with a auto-increment identity. I want to work...
4
by: shorti | last post by:
Can anyone explain in greater (and more comprehensive) detail what the RESTART option does in the ALTER TABLE table ALTER COLUMN statement. This is the description in Info Center: RESTART or...
5
by: Veeru71 | last post by:
Given a table with an identity column (GENERATED BY DEFAULT AS IDENTITY), is there any way to get the last generated value by DB2 for the identity column? I can't use identity_val_local() as...
15
by: gunnar.sigurjonsson | last post by:
I´m having some problem retrieving identity value from my newly inserted row into a view. I have two tables T1 and T2 which I define as following CREATE TABLE T1 ( id BIGINT GENERATED ALWAYS...
13
by: PinkBishop | last post by:
I am using VS 2005 with a formview control trying to insert a record to my access db. The data is submitted to the main table no problem, but I need to carry the catID to the bridge table...
0
by: Frank Swarbrick | last post by:
So we're trying to decide if it's better to use IDENTITY columns or sequences to create a surrogate key as the primary key for our tables. I kind of like the identity column, because it's more...
11
by: stegze | last post by:
Hi All, I have a problem with a DB2 server of my customer. It is a Debian Linux running DB2 Express-C. I have an IDENTITY field as PK in a table and I use this value as FK in another table. Two...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.