php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #32241 Why not have mssql_insert_id function when use Microsoft sql server database!
Submitted: 2005-03-09 03:10 UTC Modified: 2005-07-27 20:01 UTC
Votes:4
Avg. Score:5.0 ± 0.0
Reproduced:4 of 4 (100.0%)
Same Version:3 (75.0%)
Same OS:3 (75.0%)
From: kangtk at 163 dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.3.10 OS: Windows2000 Server
Private report: No CVE-ID: None
 [2005-03-09 03:10 UTC] kangtk at 163 dot com
Description:
------------
I can use this function mysql_insert_id to get the insert id when I connect with mysql database.

But I cann't use the mssql_insert_id when I change the code to Microsoft Sql server databse.

Can you explain something to me?

Thanks.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-27 04:05 UTC] Daniel dot Spada at det dot wa dot edu dot au
To expand on the previous poster. I have found that there is no such function mssql_insert_id() when using MS-SQL server.

I am using PHP 4.3.10-15, with SQL server 2000. A mssql_insert_id function would be REALLY handy to assist in error checking etc.
 [2005-07-27 11:12 UTC] tony2001@php.net
The underlying library doesn't provide something like that, so PHP doesn't provide a wrapper.
There is nothing we can do, ask MS about it.
 [2005-07-27 20:01 UTC] fmk@php.net
It is possible to obtain this value from the server with an explicit sql statement:

INSERT INTO jobs (job_desc,min_lvl,max_lvl) VALUES ('Accountant',12,125)
SELECT @@IDENTITY AS 'Identity'

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 20:01:28 2024 UTC