a developer's notes – a semi-technical web development BLOG

September 5, 2011

How to search all columns of all tables in a sql database for a keyword

Filed under: SQL — Duy Nguyen @ 2:26 pm
Tags: , , , , , ,

How to search all columns of all tables in a database for a keyword? Check out this great blog entry: http://vyaskn.tripod.com/search_all_columns_in_all_tables.htm

You can also use these queries to find which table a particular column name resides in:

SELECT name FROM sysobjects WHERE id IN ( SELECT id FROM syscolumns WHERE name = ‘MYCOLUMNNAME’ )

SELECT name FROM sysobjects WHERE id IN ( SELECT id FROM syscolumns WHERE name like ‘%PART_OF_NAME%’ )

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: