From: Mario on 31 Dec 2009 07:06 I have identity int column with increment 1 and seed 1. I wish to reseed ID column when I delete some rows and inserting new one. I try to create trigger like this one: ALTER TRIGGER Trigger2 ON Table2 FOR DELETE AS /*IF UPDATE(id) */ DBCC CHECKIDENT ('Table2', RESEED) But inserting continuous with the next int value in ID column, although I deleted some rows. How to reseed my ID column with the last one existing in a database?
From: PvdG42 on 31 Dec 2009 11:50 "Mario" <pascal(a)po.t-com.hr> wrote in message news:hhi43s$qen$1(a)ss408.t-com.hr... > I have identity int column with increment 1 and seed 1. > I wish to reseed ID column when I delete some rows and inserting new one. > I try to create trigger like this one: > > ALTER TRIGGER Trigger2 > ON Table2 > FOR DELETE > AS > /*IF UPDATE(id) */ > DBCC CHECKIDENT ('Table2', RESEED) > > But inserting continuous with the next int value in ID column, although I > deleted some rows. > > How to reseed my ID column with the last one existing in a database? You're more likely to get useful responses if you ask in a discussion group for the DBMS you are using. This group is for .NET programming questions. If you are using SQL Server, there are numerous groups that begin with: microsoft.public.sqlserver where you'll quickly get the assistance you need.
From: Gregory A. Beamer on 31 Dec 2009 12:19 Mario <pascal(a)po.t-com.hr> wrote in news:hhi43s$qen$1(a)ss408.t-com.hr: > I have identity int column with increment 1 and seed 1. > I wish to reseed ID column when I delete some rows and inserting new > one. I try to create trigger like this one: > > ALTER TRIGGER Trigger2 > ON Table2 > FOR DELETE > AS > /*IF UPDATE(id) */ > DBCC CHECKIDENT ('Table2', RESEED) > > But inserting continuous with the next int value in ID column, > although I deleted some rows. > > How to reseed my ID column with the last one existing in a database? If you are deleting all the ending rows, then this is useful ... perhaps. it is more useful for human dynmics than anything else. If you are deleting out of "random" spots in the table, this will have no effect. NOTE: The CHECKIDENT works best, for the purpose you desire, when you actually set up a reseed value. Having "holes" in a table should not matter, except to humans who look at them. And reseeding after deletion has some possible disastrous effects, esp. if you have not been diligent with your referential integrity. Peace and Grace, -- Gregory A. Beamer (MVP) Twitter: @gbworld Blog: http://gregorybeamer.spaces.live.com ******************************************* | Think outside the box! | *******************************************
From: Gregory A. Beamer on 31 Dec 2009 12:20 "PvdG42" <pvdg42(a)toadstool.edu> wrote in news:eMswcljiKHA.1540(a)TK2MSFTNGP06.phx.gbl: > You're more likely to get useful responses if you ask in a discussion > group for the DBMS you are using. This group is for .NET programming > questions. > > If you are using SQL Server, there are numerous groups that begin > with: > > microsoft.public.sqlserver > > where you'll quickly get the assistance you need. People see .General and ignore everything else. ;-) Peace and Grace, -- Gregory A. Beamer (MVP) Twitter: @gbworld Blog: http://gregorybeamer.spaces.live.com ******************************************* | Think outside the box! | *******************************************
From: Mario on 1 Jan 2010 09:28 On 31.12.2009. 18:20, Gregory A. Beamer wrote: > "PvdG42"<pvdg42(a)toadstool.edu> wrote in > news:eMswcljiKHA.1540(a)TK2MSFTNGP06.phx.gbl: > >> You're more likely to get useful responses if you ask in a discussion >> group for the DBMS you are using. This group is for .NET programming >> questions. >> >> If you are using SQL Server, there are numerous groups that begin >> with: >> >> microsoft.public.sqlserver >> >> where you'll quickly get the assistance you need. > > People see .General and ignore everything else. ;-) > > Peace and Grace, > Ok. To redefine a question ie to ask another thing I need is how to fill the first column of the ListView with the row number? Consist the row deleting.
|
Next
|
Last
Pages: 1 2 Prev: msn home page colour / weather change Next: No sound after updating SP2 for Vista |