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.
Author |
Topic |
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-03-21 : 07:54:16
|
Is ther any alternate solution for the below code... ( for reset the IDENTITY value).....I dont have permissions for DBCC command..Eg: DBCC CHECKIDENT ("Person.AddressType", RESEED, 10);My colleague deleted data by using DELETE statement. so we can't use TRUNCATE approach alsoPlease let me know the other approaches...--Chandu |
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2013-03-21 : 08:07:40
|
why can't you use truncate? Even if there is no data, you should still be able to use it. |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2013-03-21 : 10:36:30
|
Ultra drastic: Drop table, recreate How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2013-03-21 : 11:53:02
|
The real question is "Why do you care about gaps in the identity column?"... N 56°04'39.26"E 12°55'05.63" |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-03-22 : 01:06:25
|
DonAtWork --> we don't have permissions to DROP and CREATE ( even don't have DBCC permission in development Server)SwePeso --> we have to insert new actual data into server after deletion of old data--Chandu |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-03-22 : 01:14:10
|
quote: Originally posted by RickD why can't you use truncate? Even if there is no data, you should still be able to use it.
My table which has identity column is child table ( depending on many tables..)So i can't use TRUNCATE command for that table--Chandu |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2013-03-22 : 13:20:13
|
quote: Originally posted by bandi SwePeso --> we have to insert new actual data into server after deletion of old data--Chandu
That doesn't really answer the question. Are you saying that you are inserting data and need to control the identity? If so, then aren't you already overridding the identity? (IDENITY INSERT) If not, then what Peso is asking is: What difference does it make what the Identity value is?The identity value doesn't/shouldn't matter. If it does matter then I'd question the design. Do all the deletes you want and don't worry about the idenity value.I realize this probalby isn't want you are looking for, but here is an article by Peso on how to reuse IDs:http://www.sqlteam.com/article/efficiently-reuse-gaps-in-an-identity-column |
|
|
|
|
|