yii\db\mssql\SqlsrvPDO::lastInsertId PHP Method

lastInsertId() public method

SQLSRV driver implements [[PDO::lastInsertId()]] method but with a single peculiarity: when $sequence value is a null or an empty string it returns an empty string. But when parameter is not specified it works as expected and returns actual last inserted ID (like the other PDO drivers).
public lastInsertId ( string | null $sequence = null ) : integer
$sequence string | null the sequence name. Defaults to null.
return integer last inserted ID value.
    public function lastInsertId($sequence = null)
    {
        return !$sequence ? parent::lastInsertId() : parent::lastInsertId($sequence);
    }
SqlsrvPDO