Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Finding a Field

Posted on 2011-02-21
3
Medium Priority
?
482 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 9

Accepted Solution

by:
s_chilkury earned 2000 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:Ephraim Wangoya
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

610 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