Get All Tables and Storeprocedure of the Database in Sqlserver

Sometimes we have to   collect all tables or stored procedures of your database with schema name.Use the below script to get all the tables or stored procedures.

 To Get all Tables Below script

 SELECT ”+SCHEMA_NAME(schema_id)+’.’+name+” AS AllTable

FROM sys.tables

 To Get All stored procedures

 SELECT SCHEMA_NAME(schema_id)+’.’+name+” as AllProcedures

FROM sys.procedures WHERE [type] = ‘P’

AND is_ms_shipped = 0AND [name] NOT LIKE ‘sp[_]%diagram%’

Advertisements