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 |
|
JmaC
Starting Member
18 Posts |
Posted - 2010-08-27 : 00:19:38
|
| hi all...i have registration form with button DELETE,EDIT,INSERT..All working fine...example table:i have table with 5rows...1 | Peter2 | James3 | Helen4 | Nickles5 | Johnif i delete ID 3 (3|Helen) from table...1 | Peter2 | James4 | Nickles5 | Johnnow am going to register new person...what i need is when i click INSERT button in form ID:3 have to appear automatically in textbox/dropdownlist to register new person.(use deleted ID for register new person).i write coding for get ID:6 and it's working good...SELECT min(PANG)FROM (SELECT AccNo + 1 AS PANG FROM debtor EXCEPT SELECT AccNo FROM Debtor)AS boon WHERE PANG >300000000the problem is: 1) What if there are two users clicking INSERT? Both will be suggested ID:3I create trigger to solve this problem...CREATE TRIGGER TGRDebtorON dbo.DebtorFOR UPDATEASIF ()ENDgocan anyone help me out....Thanks & RegardsJmaC |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-08-28 : 01:01:52
|
| why should you put new record in deleted position? it will not preserve the sequence of insertion and in case you want to retrieve records in inserted order you would have no way to do that unless you've some audit columns. I dont really think you need to worry about gaps in ID values.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|