note 84776 added to function.mssql-query
| From: | Jos at osu1 dot php dot net | Date: | Tue, 29 Jul 2008 20:35:06 +0000 |
| Subject: | note 84776 added to function.mssql-query | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-142906@lists.php.net to get a copy of this message | ||
Even if the ID is not an IDENTITY column, you can still use OUTPUT to return the ID (supposing the
ID is still auto-generated by a trigger or another function):
INSERT INTO [myTable] ([name], [address]) OUTPUT INSERTED.[userId] VALUES ('Jos',
'Somewhere')
It will return userId from the newly inserted record.
This works well with SQL Server 2005 - I don't know about older versions.
----
Server IP: 83.137.20.135
Probable Submitter: 82.168.69.175
----
Manual Page -- http://www.php.net/manual/en/function.mssql-query.php
Edit -- https://master.php.net/note/edit/84776
Del: integrated -- https://master.php.net/note/delete/84776/integrated
Del: useless -- https://master.php.net/note/delete/84776/useless
Del: bad code -- https://master.php.net/note/delete/84776/bad+code
Del: spam -- https://master.php.net/note/delete/84776/spam
Del: non-english -- https://master.php.net/note/delete/84776/non-english
Del: in docs -- https://master.php.net/note/delete/84776/in+docs
Del: other reasons-- https://master.php.net/note/delete/84776
Reject -- https://master.php.net/note/reject/84776
Search -- https://master.php.net/manage/user-notes.php