Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get last inserted row in sql server

How can i get Last inserted row when in table there is no Uniqueidentifier or identity column.

I am waiting of your good idea's.

like image 586
Pankaj Agarwal Avatar asked Jul 11 '26 21:07

Pankaj Agarwal


2 Answers

You need some way of being able to identify the ordering of the rows to determine that. Something like a "creation date" or IDENTITY column.

like image 138
AdaTheDev Avatar answered Jul 21 '26 04:07

AdaTheDev


If you want to get last row from table without uniqueIdentifier or identity then you can use insert trigger.

like image 23
Deepak Avatar answered Jul 21 '26 03:07

Deepak



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!