In SQL Server 2008 and higher what is the best/safest/most correct way
You can try:
SELECT id FROM your_table WHERE id = (SELECT MAX(id) FROM your_table)
Where id is a primary key of the your_table
id
your_table