MSSQL and @@identity

From: Date: Wed, 11 Apr 2001 10:40:16 +0000
Subject: MSSQL and @@identity
Groups: php.db 
Request: Send a blank email to php-db+get-8474@lists.php.net to get a copy of this message
Hi, I'm trying to insert a row into an MSSQL7 table using the SQL string: INSERT INTO person (birthdate,deathdate,sname,othername,motherid,fatherid) VALUES ('1978-10-06',NULL,'Fairs','Daniel',NULL,NULL) SELECT @@identity AS last_identity The actual PHP code is $oRes = mssql_query("SET NOCOUNT ON " . $sSQL, $this->iConnIndex) ; if ($oRes) echo "yea" ; else echo "nay" ; die() ; ... and 'nay' gets printed.... I've tried both SET NOCOUNT ON and SET NOCOUNT OFF, and also omitting the SET NOCOUNT completely. Any ideas why I'm not getting the last id back? Cheers, Dan

« previous php.db (#8474) next »