Solved

Finding a Field

Posted on 2011-02-21
3
471 Views
Last Modified: 2013-11-05
I'm sure this is a long shot, but I'll ask anyway.

I have a database that contains roughly 400 tables, and probably a similar amount of views.

Some where in all that, there is a field I'm looking for with a name that contains the word "Applied" (Might be Applied_Total or Applied_Sum or other some such).  Now, I could take the next two or three hours and look at the field listing of each table and view and try and find out which one(s) I'm looking for, but that is way too tedius.

Is there any way to find out which tables (and maybe views) which contain the fields which contain the word "Applied"?
0
Comment
Question by:Clif
3 Comments
 
LVL 9

Accepted Solution

by:
s_chilkury earned 500 total points
ID: 34945448
SELECT table_name=sysobjects.name,
         column_name=syscolumns.name,
         datatype=systypes.name,
         length=syscolumns.length
    FROM sysobjects
    JOIN syscolumns ON sysobjects.id = syscolumns.id
    JOIN systypes ON syscolumns.xtype=systypes.xtype
   WHERE sysobjects.xtype='U'
            AND syscolumns.name LIKE '%Applied%'
ORDER BY sysobjects.name,syscolumns.colid

OR

SELECT name FROM sysobjects WHERE id IN ( SELECT id FROM syscolumns WHERE name LIKE '%Applied%' ) ORDER BY name
0
 
LVL 32

Expert Comment

by:ewangoya
ID: 34945531

select sys.objects.name as [Table name], sys.columns.name as [Column]
from sys.columns
inner join sys.objects ON sys.objects.object_id = sys.columns.object_id
where type = 'U'
and sys.columns.name like '%Applied%'
0
 
LVL 10

Author Closing Comment

by:Clif
ID: 34945647
That was perfect.

To tell you the truth, I was sure I was going to get a reply that it couln't be done.

Thank.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now