|
Execute the following Microsoft SQL Server Transact-SQL (T-SQL) script in Management Studio (SSMS) Query Editor, SQLCMD or other client software
r to find out what tables and views have the CustomerID column:
use AdventureWorks
go
select
'Schema'= s.name,
'ObjectName' = o.name,
'Table/View' = case o.type
when 'U' then 'Table'
when 'V' then 'View'
else ''
end,
'Column' = c.name
from sys.columns c
join sys.objects o
on c.object_id = o.object_id
join sys.schemas s
on o.schema_id = s.schema_id
where c.name ='CustomerID'
and o.type in ('U','V')
order by 'Table/View'
|