Tags

Here is the script:

SELECT c.object_id,
 CASE
     WHEN OBJECTPROPERTY(c.object_id, 'isTable') = 1
     THEN 'Yes' ELSE 'No' END AS IsTable,
 CASE
     WHEN OBJECTPROPERTY(c.object_id, 'isView')  = 1
     THEN 'Yes' ELSE 'No' END AS IsView,
 OBJECT_SCHEMA_NAME(c.object_id) AS SchemaName,
 OBJECT_NAME(c.object_id) AS TableName,
 c.name AS ColumnName
 FROM sys.columns c
 WHERE c.name LIKE '%MyColumnName%'
Advertisements