TYPO3 Exception 40

Indicates an SQL error has occurred, please check your ext_tables.sql files.

For example:

The column 'columnname' on table 'tablename' already exists
Copied!

This happens for example if the file ext_tables.sql of a TYPO3 extension has the same field twice for a table.:

CREATE TABLE sys_products_fe_users_mm_visited_products (
    uid int(11) NOT NULL auto_increment,
    pid int(11) DEFAULT '0' NOT NULL,
    tstamp int(11) DEFAULT '0' NOT NULL,
    crdate int(11) DEFAULT '0' NOT NULL,
    deleted tinyint(4) DEFAULT '0' NOT NULL,
    hidden tinyint(4) DEFAULT '0' NOT NULL,
    tstamp int(11) unsigned DEFAULT '0' NOT NULL,
    uid_local int(11) DEFAULT '0' NOT NULL,
    uid_foreign int(11) DEFAULT '0' NOT NULL,
    qty int(11) unsigned DEFAULT '0' NOT NULL,
Copied!
    PRIMARY KEY (uid),
    KEY uid_local (uid_local),
    KEY uid_foreign (uid_foreign),
);
Copied!

There are 2 fields tstamp in the table sys_products_fe_users_mm_visited_products

Removing the second line with the field tstamp from table sys_products_fe_users_mm_visited_products fixes the problem in this case.