Home All Groups Group Topic Archive Search About
Author
24 Mar 2006 3:29 PM
js
Hi, how to find out what table, field contain "mysearchtext" in side? Thanks
a lot.

Author
24 Mar 2006 3:49 PM
ML
Check out the INFORMATION_SCHEMA system views for more info, but here's
something you can use fight now:

select    INFORMATION_SCHEMA.[COLUMNS].TABLE_NAME
    from    INFORMATION_SCHEMA.[COLUMNS]
    where    (INFORMATION_SCHEMA.[COLUMNS].COLUMN_NAME = 'mysearchtext')


ML

---
http://milambda.blogspot.com/
Author
24 Mar 2006 4:03 PM
js
Thanks ML,
How about search field content? hwo to do that?

Show quote
"ML" <M*@discussions.microsoft.com> wrote in message
news:C744B478-EE78-4378-9528-13106F88443C@microsoft.com...
> Check out the INFORMATION_SCHEMA system views for more info, but here's
> something you can use fight now:
>
> select INFORMATION_SCHEMA.[COLUMNS].TABLE_NAME
> from INFORMATION_SCHEMA.[COLUMNS]
> where (INFORMATION_SCHEMA.[COLUMNS].COLUMN_NAME = 'mysearchtext')
>
>
> ML
>
> ---
> http://milambda.blogspot.com/
Author
24 Mar 2006 3:55 PM
Raymond D'Anjou
"js" <j*@someone.com> wrote in message
news:eLWFGf1TGHA.2656@TK2MSFTNGP10.phx.gbl...
> Hi, how to find out what table, field contain "mysearchtext" in side?
> Thanks a lot.

You want to search through all tables and columns?

A combination of the undocumented stored procedure "sp_MSforeachtable",
this statement: select column_name from INFORMATION_SCHEMA.COLUMNS where
table_name = 'tableName'
a cursor,
dynamic SQL
and: select ... from tableName where columnName like '%mysearchtext%'

AddThis Social Bookmark Button