| SQL Query to find ColumnName in any table?
Below is the query is used to test that column is exists or not in any given table.
IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'Table_Name'
AND COLUMN_NAME = 'Column_Name')
IF COL_LENGTH('schemaName.tableName', 'columnName') IS NOT NULL
BEGIN
-- Column Exists
END
| | |