Database Objects Information Using SQL Query in SQL Server


In this article we will see how to get the Database objects Information using a query.

What are database objects?

  1. Views
  2. Tables
  3. Stored Procedure etc.


Helpful information available:

  1. Object
  2. Type
  3. Type_desc
  4. Schema_id and also we have more info in that table.


Step 1: Gets the complete information of database Views under the used Database:

use AdventureWorks

select * from sys.views


Step 2: Output of Sys.views:

Image 1.jpg

Step 3: Gets the complete information of database Tables under the used Database:

use AdventureWorks
select
* from sys.tables

Step 4: Output of Sys.tables:

image2.jpg

Step 5: Gets the complete information of database Procedures under the used Database:

use AdventureWorks

select * from sys.procedures


Step 6: Output of Sys. procedures:

image3.jpg

Step 7: Gets the complete information of database Objects under the used Database:

use AdventureWorks
select
* from sys.objects


Step 8: Output of Sys.objects:

image4.jpg

Thanks for reading this article. Have a nice day.


Similar Articles