How to get last insert id in MSSQL using PHP

How to get last insert id in MSSQL using PHP

[adrotate group="5"]

How to get last insert id in MSSQL using PHP, this is simple code to get last insert id in MSSQL & PHP. In MySQL and PHP it’s mysql_insert_id. But in case of mssql & PHP it’s different. for getting last insert id we need to @@IDENTITY. Here is the code you can use it for fetching last insert id in mssql.

SELECT @@IDENTITY FROM <code>tablename</code>
Vivek Vengala
 

Vivek Vengala is a Online Entrepreneur, Web Developer from Hyderabad India.

Click Here to Leave a Comment Below 0 comments

Leave a Reply: