Asset Management Suite

 View Only

How to Search Tables and Views for columns 

Sep 18, 2012 01:39 PM

If you have ever needed to create a report but dont know what table you are looking for this might help you out. In my case I had to find something that had the "Publisher".

 To look for columns in view...

USE
Symantec_CMDB
SELECT
V.name AS View_name,
SCHEMA_NAME(schema_id) AS schema_name,
c.name AS column_name
FROM sys.views AS v
INNERJOIN sys.columns cON v.OBJECT_ID = c.OBJECT_ID
WHERE c.name LIKE'%Publisher%'
ORDER BY schema_name, View_name;

To look for columns in tables...

USE
Symantec_CMDB
SELECT t.name AS table_name,
SCHEMA_NAME(schema_id) AS schema_name,
c.name AS column_name
FROM sys.tables AS t
INNERJOIN sys.columns cON t.OBJECT_ID = c.OBJECT_ID
WHERE c.name LIKE'%Publisher%'
ORDER BY schema_name, table_name;


 

Statistics
0 Favorited
0 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Related Entries and Links

No Related Resource entered.