This is not a very practical question, but I thought would be a good theoretical exercise.
What I want to do is retrieve the next available identity value for a given table, BEFORE AN INSERT OCCURS. I was trying to write a generic stored procedure that you could supply the table name and the rest would be taken care of.
This idea first came to me while I was trying to find a work around, for a bit of code already written. I have taken a different approach to the problem as this is not practical in a multi-user environment, but I would like to know if it is actually possible...
Looking forward to hearing a correct answer.