This is my table.
Ticket(id int auto_increment,name varchar(50));
after inserting into this table i want send id and name to mail.. how can i get the last Inserted value.
help to solve this...
Look into: Scope_identity
SCOPE_IDENTITY()
The table which is having Identity Property from that table we can get the last inserted record id will be like this
SELECT SCOPE_IDENTITY()
OR
But this is not a safe technique:
SELECT MAX(Id) FROM Ticket
OR
This is also not a safe technique:
SELECT TOP 1 Id FROM Ticket ORDER BY Id DESC