Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Search of table names

I use the following to search for strings within the stored procedures of a specific database:

USE DBname SELECT Name FROM sys.procedures WHERE OBJECT_DEFINITION(OBJECT_ID) LIKE '%xxx%' 

Is it easy to amend the above so that it searches Table names in a specific db "DBname" ?

like image 831
whytheq Avatar asked Oct 26 '12 11:10

whytheq


People also ask

Can you search for a table in SQL?

SQL Server Management Studio Object Explorer browse to the database you want to search through. write the name (full or partial) of the database object in the Search text box. press Enter to start the search process.

How do I get a list of table names in MySQL?

The syntax to get all table names with the help of SELECT statement. mysql> use test; Database changed mysql> SELECT Table_name as TablesName from information_schema.


2 Answers

I'm using this and works fine

SELECT * FROM INFORMATION_SCHEMA.TABLES  WHERE TABLE_NAME LIKE '%%' 
like image 110
NeshaSerbia Avatar answered Sep 27 '22 19:09

NeshaSerbia


select name   from DBname.sys.tables  where name like '%xxx%'    and is_ms_shipped = 0; -- << comment out if you really want to see them 
like image 29
RichardTheKiwi Avatar answered Sep 27 '22 20:09

RichardTheKiwi