/**
* Find the amount of auto-increment "space" has been used. This may can help identify
* tables that are running out of available ID values.
*/
SELECT
	t.table_name,
	t.column_name,
	-- The highest possible ID that can be created with this data-type.
	t.max_value,
	-- The last ID created in this table.
	t.auto_increment,
	-- The amount of "ID space" that has been used-up. When this hits 100%, things go
	-- "Boom"!
	CONCAT( ( t.auto_increment_ratio * 100 ), '%' )
FROM
	sys.schema_auto_increment_columns t
WHERE
	t.table_schema = @db
;