How can I find all columns of a certain type (for example NTEXT
) in all tables in a SQL Server database?
I am looking for a SQL query.
The easiest and straightforward way to check for the column in a table is to use the information schema for column system view. Wright a select query for INFORMATION_SCHEMA. COLUMNS as shown below. If the query returns record, then the column is available in the table.
You can use following query to return fields
SELECT table_name [Table Name], column_name [Column Name] FROM information_schema.columns where data_type = 'NTEXT'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With