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 |
jonasalbert20
Constraint Violating Yak Guru
300 Posts |
Posted - 2008-04-10 : 21:16:20
|
I have an auto-incremented field. What I want is to retrieve the deleted incremented field. Let me show you an example...transid-------------------12deleted45deleted7deleted910 Desired result:transid_deleted-------------------368 thanks in advance. For fast result follow this...http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspxWant Philippines to become 1st World COuntry? Go for World War 3... |
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
|
jonasalbert20
Constraint Violating Yak Guru
300 Posts |
|
ranganath
Posting Yak Master
209 Posts |
Posted - 2008-04-15 : 02:18:47
|
hi, try with thisDeclare @T Table (Id Int)Insert into @TSelect 1 Union AllSelect 2 Union AllSelect 4 Union AllSelect 5 Union AllSelect 8 Union AllSelect 10 --Select * From @TDeclare @MaxId IntSelect @MaxId = Max(Id) From @TSelect A.NumberFrom (Select Number From Master..Spt_Values where Type= 'P' and Number > 0)Awhere Number not in (Select Id From @T) and Number < @MaxId |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-04-15 : 04:03:53
|
http://www.nigelrivett.net/SQLTsql/FindGapsInSequence.htmlMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|