returning id of new item

  • Thread starter Thread starter Brian Henry
  • Start date Start date
B

Brian Henry

What is the best way to do this? (in a stored procedure of course) this is
how i was thinking, are there any problems with this? here is my pseudo code
for the stored proc...

* Data recieved through paramaters
* Select top 1 ID from table ordered in descending order save into a temp id
+ 1 so its the next blank id in @currentid
* insert into table with ID = @currentid
* return @currentid

is that the standard way to do it or is there a better way? thanks!
 
sql 2000, this was posted to this group on accident, i ment to post it to
the sql server group.. must of saw ado and thought sql when i was selecting
the group to post to from the list
 
Back
Top