Fix “Arithmetic overflow error converting IDENTITY to data type…” in SQL Server

If you’re getting error “Msg 8115, Level 16 Arithmetic overflow error converting IDENTITY to data type…” error in SQL Server, it’s probably because you’re trying to insert data into a table when its IDENTITY column has reached its data type’s limit.

An IDENTITY column automatically increments the value that’s inserted with each new row. If the value being inserted is out of the range of the column’s data type, then the above error will occur.

Continue reading

Oracle DROP TABLE IF EXISTS Alternatives

The very useful DROP TABLE IF EXISTS syntax was finally introduced in Oracle Database – Oracle Database 23c to be precise. This syntax allows us to run a DROP TABLE statement without getting an error if the table doesn’t exist.

Earlier versions of Oracle don’t support the IF EXISTS clause. Therefore, if we want to avoid any nasty errors resulting from trying to drop a non-existent table, we need to do a bit of extra work.

Below are three options for dropping a table if it exists in Oracle.

Continue reading