Select View / Table / SP Definition

Azure da tanımlı viewları, tabloların içeriklerini, sp lerin tanımlarını aşağıdaki SQL ile bulabilirsiniz.

# SQL Commands in Table
select schema_name(v.schema_id) as schema_name,
       v.name as view_name,
       v.create_date as created,
       v.modify_date as last_modified,
       m.definition
from sys.views v
join sys.sql_modules m
     on m.object_id = v.object_id
--where m.definition like '%top%'
 order by schema_name,
          view_name;

# Table Names
select schema_name(t.schema_id) as schema_name,
       t.name as table_name,
       t.create_date,
       t.modify_date
from sys.tables t
order by schema_name,
         table_name;


# SP Definitions
SELECT ROUTINE_DEFINITION,*
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_NAME = 'spName';

Leave a Comment