SQL Server and Find all Columns in a Database

Where the column name matches exactly…
SELECT name FROM sysobjects WHERE id IN ( SELECT id FROM syscolumns WHERE name = '{text}' )

Where the column name is like…
SELECT name FROM sysobjects WHERE id IN ( SELECT id FROM syscolumns WHERE name like '%{text}%' )

The following will show all occurrences of the column in any object
SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME LIKE '%doctorid%'

Author

Admin

comments powered by Disqus

Categories

Recent Tweets

"Setting up and Getting Started with Power BI Embedded | Data Exposed" channel9.msdn.com/Shows/Data-Exp… #webcast #feedly
Retweeted by @dyardy @scottgu @victoriabeckham Worlds collide, double take on that photo!
@scottgu @victoriabeckham Worlds collide, double take on that photo!
@projectedxyz It is really easy, what are you doing (isn't this data which on the web)