getting list of tables in sql.


In this article I demonstration on getting list of tables in sql.

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 in  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'

if any problem occour frankly leave mail to me dotnetbyabhipatil@gmail.com  or  for more article      visit my blog  dotnetbyabhipatil.blogspot.in

your feedback and suggestion is always welcome for me.
Previous
Next Post »