How can I get the ID of the last INSERTed row using PDO with SQL Server?

前端 未结 2 417
故里飘歌
故里飘歌 2021-02-08 16:19

Under other circumstances I might be tempted to use

$result = mssql_query(\"INSERT INTO table (fields) VALUES (data); 
                       SELECT CAST(scope_i         


        
2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-08 16:49

    Maybe you are getting two rowsets returned. Try adding SET NOCOUNT ON; to eliminate the INSERT's rowset, or use $stmt->nextRowset if your driver supports it.

提交回复
热议问题