Get Id number

Results 1 to 2 of 2

Thread: Get Id number

  1. #1
    Join Date
    Dec 1969

    Default Get Id number

    I have just finished a &#039;add user&#039; page, after i&#039;ve done the insert statment I&#039;d like to response.redirect user to &#039;show user&#039; page. The problem is, I need to get the Id number of the user I just added. <BR><BR>Im using Ms SQL server with autonumber.<BR><BR>I tryed doing select max(Id) from tabel, this works in most cases. But If I Insert two Users, they get Id_number 123 and 124, If I then delete the last guy the database will give the next user I try to insert id_number 125 while If I do count(Id) I get 123.<BR><BR>Anyone got a solution ?<BR><BR>Lars

  2. #2
    Heaven's Martini Guest

    Default RE: Get Id number

    you bet?<BR><BR>I would assume by autonumber you mean identity.<BR><BR>my fav. solution is at <BR><BR>"returning @@identity" article<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts