Tuesday, 14 August 2012

how to get all table or store procedure name with query in SQL Server

Tested In SQLServer 2008 

Below query is used for getting all table name from Your Database in SQL server

use YourDataBaseName 

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

Below query is used for getting all Store procedure name from Your Database in SQL server

use YourDataBaseName

Select * from sys.objects where type='p'
Below query is used for getting all trigger name from Your Database in SQL server

use YourDataBaseName
Select * from sys.objects where type='tr'

this query is used for getting table field name as well as datatype and many more
SELECT *
FROM INFORMATION_SCHEMA.columns
WHERE TABLE_NAME = 'urtablename'

in bold section put the relevent name

Hope this will help you .
Thanks
ROHIT KUMAR SRIVASTAVA

No comments:

Post a Comment