Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find all Database Objects by Name?

Tags:

sql

sql-server

How can I find all database objects in a given database using an object name? We prefix all site specific tables, views, indexes, functions, constraints etc. with a constant string. I need to find all objects with names starting with that string.

like image 282
ProfK Avatar asked Mar 12 '09 18:03

ProfK


People also ask

How can I get a list of all databases?

Use SQL Server Management Studio In Object Explorer, connect to an instance of the SQL Server Database Engine, and then expand that instance. To see a list of all databases on the instance, expand Databases.

Which of the following system view provides a list of all objects in database?

The sysobjects view contains useful information about the different database objects.


1 Answers

Assuming you have the right permissions:

SELECT * FROM yourdatabasename.sys.all_objects WHERE upper(name) like upper('my prefix%')  --use UPPER for case-INsensitivity 
like image 116
JosephStyons Avatar answered Oct 04 '22 19:10

JosephStyons