Zend_Db_Adapter_Pdo_Mssql::lastInsertId PHP Method

lastInsertId() public method

As a convention, on RDBMS brands that support sequences (e.g. Oracle, PostgreSQL, DB2), this method forms the name of a sequence from the arguments and returns the last id generated by that sequence. On RDBMS brands that support IDENTITY/AUTOINCREMENT columns, this method returns the last value generated for such a column, and the table name argument is disregarded. Microsoft SQL Server does not support sequences, so the arguments to this method are ignored.
public lastInsertId ( string $tableName = null, string $primaryKey = null ) : string
$tableName string OPTIONAL Name of table.
$primaryKey string OPTIONAL Name of primary key column.
return string
    public function lastInsertId($tableName = null, $primaryKey = null)
    {
        $sql = 'SELECT SCOPE_IDENTITY()';
        return (int) $this->fetchOne($sql);
    }