Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Searching a Field

Author  Topic 

RashidYusuf
Starting Member

6 Posts

Posted - 2005-05-14 : 10:22:29
I have an urgent requirement to search a given field appearing in various tables of the given database. For an example to make it more clear: I want to list all the tables where field "idCust" is existing. Answer may please be in form of SP.


Querring out

Querring out

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-05-14 : 11:29:27
The system generated INFORMATION_SCHEMA.COLUMNS view in your database has all the information you need ....

- Jeff
Go to Top of Page

RashidYusuf
Starting Member

6 Posts

Posted - 2005-05-15 : 03:21:57
quote:
Originally posted by jsmith8858

The system generated INFORMATION_SCHEMA.COLUMNS view in your database has all the information you need ....

- Jeff




My requirement is specific. I need a SP to list all the tables where a desired field is existing. This is because I need to study a database not designed by me.
Querring out
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-05-15 : 10:26:10
Do you want us to give you guidance or do all the work for you? Did you even try opening that view and seeing what it returns? Do you know T-SQL?

- Jeff
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-05-15 : 11:00:05
Ummm, a stored procedure would use a query to get this information anyway.

And I agree with Jeff, SQL Team is not a homework service, you need to give a little effort here if you actually want to learn something.
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2005-05-16 : 09:58:30
select table_name from INFORMATION_SCHEMA.COLUMNS where column_name = 'Lazy_Consultant_To_Be'

*need more coffee*
Go to Top of Page
   

- Advertisement -