how to get last inserted record in sql server code example Example: sql get last ID SELECT MAX(id) FROM <tablename>