Dropping or modifying a column in SQL Server can look straightforward, but it often isn’t. That column might be referenced by other objects in the database, and removing it without checking can break things silently. Unlike dropping a whole table, where SQL Server is very strict about dependencies, column-level references are not always enforced or even tracked. That’s why it’s important to do some homework before making the change.
computed columns
Fix “Computed column … cannot be persisted because the column is non-deterministic” in SQL Server (Error 4936)
If you’re getting an error that reads something like “Computed column ‘c3’ in table ‘t1’ cannot be persisted because the column is non-deterministic” in SQL Server, it appears that you’re trying to persist a computed column that’s nondeterministic.
A nondeterministic function or expression returns a different result for the same input. If a column uses such an expression, then it will be nondeterministic. A computed column must be deterministic.
Fix “Computed column … in table … is not allowed to be used in another computed-column definition” (Error 1759)
If you’re getting an error that reads something like “Computed column ‘c2’ in table ‘t1’ is not allowed to be used in another computed-column definition” in SQL Server, it appears that you’re trying to create a computed column that uses another computed column.
We can’t use other computed columns in our computed column definitions.
Fix “Cannot alter column because it is ‘COMPUTED'” in SQL Server (Error 4928)
If you’re getting an error that reads something like “Cannot alter column ‘c2’ because it is ‘COMPUTED’” in SQL Server, it looks like you’re trying to alter a computed column.
We can’t alter computed columns.
Return the Definition of All Computed Columns in a SQL Server Database (T-SQL)
In SQL Server we can run a query against the sys.computed_columns system catalog view to return all computed columns and their definitions.
3 Ways to Check if a Table has a Generated Column in SQLite
If you’re not sure if a table has a generated column in SQLite, you can quickly find out with either the .schema command, or by querying the sqlite_schema table.
How to Return the Definition of a Generated Column in MariaDB
If you have a table in MariaDB with a generated column, you can use the following methods to find out its definition.
5 Ways to Check if a Table has a Generated Column in MariaDB
Here are five ways to see whether a table contains a generated column in MariaDB.
Add a Virtual Column to an Existing Table in Oracle
If we need to add a virtual column to an existing table in Oracle Database, we can do so with the usual SQL ALTER TABLE statement.
5 Ways to See if a Table has a Generated Column in MySQL
MySQL supports generated columns. If you’re not sure whether a table has a generated column or not, you can check it using any of the following methods.