可能重复:
How to get Insert id in MSSQL in PHP?我怎么可以在最后一次查询得到生成的ID通过PHP与SQL Server
我怎么可以在最后一次查询通过PHP获取生成的ID与SQL服务器,我知道如何通过MySQL mysql_inserted_id但与SQL服务器我不能plerest帮助
可能重复:
How to get Insert id in MSSQL in PHP?我怎么可以在最后一次查询得到生成的ID通过PHP与SQL Server
我怎么可以在最后一次查询通过PHP获取生成的ID与SQL服务器,我知道如何通过MySQL mysql_inserted_id但与SQL服务器我不能plerest帮助
您可以尝试@@身份。
SELECT ID AS LastID FROM Persons WHERE ID = @@Identity;
获取更多信息http://blog.sqlauthority.com/2007/03/25/sql-server-identity-vs-scope_identity-vs-ident_current-retrieve-last-inserted-identity-of-record/ – dogmatic69 2011-04-06 11:24:57
它是mssql ...? – 2011-04-06 10:29:39