Search
 
SCRIPT & CODE EXAMPLE
 

SQL

T-SQL - Where Used List (Table/View)

select schema_name(o.schema_id) + '.' + o.name as [table],
       'is used by' as ref,
       schema_name(ref_o.schema_id) + '.' + ref_o.name as [object],
       ref_o.type_desc as object_type
from sys.objects o
join sys.sql_expression_dependencies dep
     on o.object_id = dep.referenced_id
join sys.objects ref_o
     on dep.referencing_id = ref_o.object_id
where o.type in ('V', 'U')
      and schema_name(o.schema_id) = 'Person'  -- put schema name here
      and o.name = 'Person'   -- put table/view name here
order by [object]
Comment

PREVIOUS NEXT
Code Example
Sql :: code to move ietms from one table to another myswl 
Sql :: sql not null constraint 
Sql :: What are the advantages of MySQL when compared with Oracle? 
Sql :: sql agent jb is enabled query 
Sql :: MYSQL create new query tab 
Sql :: Postgresql select join by date - Join rows where a timestamp value is equal to midnight of the date 
Sql :: sql query between datetime 
Sql :: Find Last Fractal Function MQL4 
Sql :: APEX elapsed time 
Sql :: how to set sql_mode for a query in CI model 
Sql :: providername system.data. mysql 
Sql :: sql trigger to call stored procedure with parameters 
Sql :: What is the library that should import to use all functional database features in SQLite? 
Sql :: subconjuntos da linguagem SQL 
Sql :: insert data mysql with cmd 
Sql :: find invalid datetime field 
Sql :: mysql set user password for a range of ips 
Sql :: date query 
Sql :: alter server set options dbserver oracle fdw 
Sql :: mysql update sequence with order by 
Sql :: how to select only id where is not in column mysql 
Sql :: power bi find all ids not in other tables 
Sql :: sqlite3 create table from another table 
Sql :: mysql error 1215 
Sql :: suse start MySQL 
Sql :: Extend the 2.1 case study to implement below listed queries. Write separate operations/method to implement each query. a.Query all books in database. 
Sql :: Uncaught PDOException: SQLSTATE[HY000] [1698] 
Sql :: how to fetch unique records from two tables 
Sql :: execute stored procedure without db set 
Sql :: SQL Multiple Parameterized Procedures 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =