cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
GMFDE
Engaged Sweeper III
If you're like me, and SQL is not in your list of skills, you might appreciate this...

You can use this query to find a particularly obscure data field. You can run this query from within SQL Server Management Studio. Replace the word 'KEYWORD' with the data point name that are trying to find.

An example would be, you want to create a report that includes Uptime for your systems. But, you don't know what table contains that field, so you can start opening tables and scrolling through the list of fields, or you can run this...


Use lansweeperdb
GO

SELECT t.name AS table_name, SCHEMA_NAME(schema_id) AS schema_name,c.name AS column_name
FROM sys.tables AS t
INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID
WHERE c.name LIKE '%KEYWORD%' /* CHANGE NAME BETWEEN THE % */
ORDER BY schema_name, table_name;



Hope this helps
1 ACCEPTED SOLUTION
Susan_A
Lansweeper Alumni
FYI for everyone: the recently added database dictionary can be used to locate specific data and fields as well.

View solution in original post

1 REPLY 1
Susan_A
Lansweeper Alumni
FYI for everyone: the recently added database dictionary can be used to locate specific data and fields as well.