Getting List of Tables in SQL Server

Getting List of Tables in SQL

If you want to get list of table avaliable into database use any of the following 3 select statement.

Select * from  sys.objects where type='u'

 
 

Select * from sys.objects

 
 

Select * from INFORMATION_SCHEMA.TABLES



Getting List of Columns Tables in SQL

If you want to get list of columns of a table avaliable use any of the following select statement.

Select * from sys.columns  where object_id =object_id ('dbo.Student')

 
 

Select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='tbl_Employee'

 
 

Getting List of Constraints Tables in SQL

If you want to get list of constraints of a table avaliable use any of the following option

Select * from INFORMATION_SCHEMA.TABLE_CONSTRAINTS  where TABLE_NAME ='tbl_Emp'

 
 
 

 sp_helpconstraint 'tbl_Emp'

 
 

If you want get list of columns avaliable in table along with list of constraints abaliable on table used the following stored procedure.

sp_help 'tbl_Emp'

 
 
Ebook Download
View all
Learn
View all