RE: Searching table

RE: Searching table

 

  

Clarification please,

Are you searching for a column of the name 'india', for example, or are
you looking for actual data in string type columns?

If you are looking for a column name you can use the following:

SELECT T.TABLE_NAME,C.COLUMN_NAME,C.DATA_TYPE FROM
INFORMATION_SCHEMA.COLUMNS C
JOIN INFORMATION_SCHEMA.TABLES T ON C.TABLE_NAME = T.TABLE_NAME
WHERE C.COLUMN_NAME = '[Insert Column Name Here]'

If you are looking for data, you can expand upon this example to create
a loop through all tables that contain string datatypes and build select
statements for each column that you need to search...


Bill Finch MCSE,CCNA
Database Administrator
LCG Technologies, Inc.
(443) 589-1820 - Direct Line
(443) 693-2589 - Cell

-----Original Message-----
From: J.Saraboji
[mailto:mssqldba-ezmlmshield-x77359658.[Email address protected]
Sent: Friday, September 28, 2007 7:21 AM
To: LazyDBA Discussion
Subject: Searching table

Dear Experts,





Can I check the tables using data?



Example



I have a data like 'India' now I have to search the all
tables.
Which table having the data name of 'India'.





Thanks & Regards,

JSaraboji,

SQL Database Administrator,

Direction Software Solutions,

Mumbai -





---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY To post a
dba job: http://jobs.lazydba.com To subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html




This email, its electronic document attachments, and the contents
of its website linkages may contain confidential information. This
information is intended solely for use by the individual or entity
to whom it is addressed. If you have received this information in
error, please notify the sender immediately and arrange for the prompt
destruction of the material and any accompanying attachments.


MS Sql Server LazyDBA home page