In 4D v11 SQL the command Count tables was renamed to Get last table number. More importantly, this command no longer returns the number of tables in the database but, rather, the last table number used. The goal of this Tech Tip is to explain the reason for the rename (rather than the usage of the command).
In fact, in previous versions of 4D the Count tables command does not do what its name implies at all; it does not count the tables in the database. This command returns the value from an internal counter. In this way it behaves much like Sequence number. Sequence number does not count the records in a table but, rather, increments an internal counter every time a record is saved. Similarly, each time a table is created in the database the value returned by Count tables is incremented. Since tables cannot be deleted in previous versions of 4D, the design of Count tables is valid and returns the right value.
This command is unchanged in 4D v11 SQL other than in name. That is, the behavior is *exactly* the same. The command still returns the value in the internal counter. However, now that tables can be deleted, the result is that it no longer reflects the number of tables in the database, so the command was renamed. Interestingly the new name is perhaps more accurate than the old name!