Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Problem with resetting identity colum

Author  Topic 

diwakar_m
Starting Member

19 Posts

Posted - 2008-05-14 : 07:18:34
Say I have a table with two columns

TABLE_A ( col1 INT IDENTITY(1,1) , col2 VARCHAR(10) )

Now i insert some values into this table.
AAA
BBB
CCC
DDD

The table would like this
1 , AAA
2 , BBB
3 , CCC
4 , DDD


Now if i delete a row. Say for example 3rd row. The result would be
1 , AAA
2 , BBB
4 , DDD

Is there any way to reset this to
1 , AAA
2 , BBB
3 , DDD


Sorry for being prolix.
Thanks in advance.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-05-14 : 07:23:02
No.
And why should you?


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

diwakar_m
Starting Member

19 Posts

Posted - 2008-05-14 : 07:29:36
Well it is the business requirement.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-05-14 : 07:37:18
Then the business needs to relearn.
Has also the IDENTITY column a foreign key/primary key contraint?



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

diwakar_m
Starting Member

19 Posts

Posted - 2008-05-14 : 07:39:42
Yes the identity column is a primary key
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-14 : 07:54:12
quote:
Originally posted by diwakar_m

Yes the identity column is a primary key


can you specify what is the exact requirement that's prompting you for this?
Go to Top of Page

diwakar_m
Starting Member

19 Posts

Posted - 2008-05-14 : 08:02:42
It's complicated. Can you please tell me whether it is possible or not?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-05-14 : 08:35:26
Which part in the response I gave 05/14/2008 : 07:23:02 did you not understand?
Please describe what knowledge you lack and I can fill them in for you.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

diwakar_m
Starting Member

19 Posts

Posted - 2008-05-14 : 08:42:11
quote:
Originally posted by Peso

Which part in the response I gave 05/14/2008 : 07:23:02 did you not understand?
Please describe what knowledge you lack and I can fill them in for you.



E 12°55'05.25"
N 56°04'39.16"




Now i see why are being too arrogant. Just because you are an SQL guru doesn't entitle you with clumsy handling of freshers questions.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-05-14 : 08:45:20
I am not a Guru. I am a Patron Saint of Lost Yaks.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-14 : 10:02:57
quote:
Originally posted by diwakar_m

It's complicated. Can you please tell me whether it is possible or not?


Before that can you post what's the requirement thats prompting you for doing this?
Go to Top of Page

cat_jesus
Aged Yak Warrior

547 Posts

Posted - 2008-05-16 : 17:52:28
quote:

Now i see why are being too arrogant



Is that more arrogant than assuming your business requirements are too complicated for us to understand?

quote:

Can you please tell me whether it is possible or not?



I will answer your question. Yes it's possible. It's also possible to pop your eyeball out with a spoon. In both cases we are forced to ask, why would you want to?



An infinite universe is the ultimate cartesian product.
Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2008-05-16 : 21:19:22
quote:
Originally posted by diwakar_m

It's complicated. Can you please tell me whether it is possible or not?

What he's telling you is that it is stupid. Renumbering a surrogate key is one of the hallmarks of noob DBAs. He's giving you the opportunity to bypass that mistake. Take it.

e4 d5 xd5 Nf6
Go to Top of Page
   

- Advertisement -