April 12, 2009 at 10:17 am
Hi,
Can any body let me know the query to select all the tables in the database with a particular word on it.
Thanks,
Soofy
April 12, 2009 at 11:07 am
start with:
Select ...
from information_schema.tables
where table_name like '%yourcryteria%'
order by table_name
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
April 13, 2009 at 6:03 am
You can also try the following:
use database_name
select * from sys.tables where type ='u'
and name like '%criteria%'
April 13, 2009 at 12:19 pm
if you're stuck in a pre 2005 world you would do:
select * from sysobjects where type ='u'
and name like '%your_table_name%'
April 13, 2009 at 1:28 pm
INFORMATION_SCHEMA views also work with pre sql2005 versions.
To only select actual tables you need to add the where clause
Where TABLE_TYPE = 'BASE TABLE'
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
April 13, 2009 at 1:31 pm
ALZDBA (4/13/2009)
INFORMATION_SCHEMA views also work with pre sql2005 versions.To only select actual tables you need to add the where clause
Where TABLE_TYPE = 'BASE TABLE'
thx. i didn't mean to imply that it wouldn't.
April 13, 2009 at 10:51 pm
thnx for enlightening me. m still a novice...
April 15, 2009 at 6:11 am
You could also use
sp_tables '%yourcriteria%'
May 7, 2014 at 3:05 pm
select * from sys.tables
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply