Solved

Finding a Field

Posted on 2011-02-21
3
470 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

758 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

22 Experts available now in Live!

Get 1:1 Help Now