filmov
tv
How to Find if Table/View is used by Stored Procedure in SQL Server - SQL Server Interview Questions

Показать описание
In this video, we are going to learn how to find out if the table is used in a Stored Procedure. we have multiple ways to do that.
This System Stored Procedure will return you list of table/views used by the Stored procedure/View. You can pass the view name or Stored Procedure as parameter,it will return you tables/views which are used in the object.
One disadvantage of using sp_depends is , it will not show you tables/views which are not in current database. If you have used objects from other databases, this information might be misleading.
--By using sp_depends, You can provide Stored Procedure Name or View name as parameter
EXEC sp_depends '[dbo].[GetCustomer]'
SELECT DISTINCT OBJECT_NAME(SD.id) AS StoredProcedureNameName,
OB.name AS TableOrViewName
ON SD.id=O.id
ON SD.depid=OB.id
AND O.xtype='P'
--in a Stored Procedure
SELECT OBJECT_NAME(OBJECT_ID),definition
WHERE definition LIKE '%vw_Employee%'
Link to post:
This System Stored Procedure will return you list of table/views used by the Stored procedure/View. You can pass the view name or Stored Procedure as parameter,it will return you tables/views which are used in the object.
One disadvantage of using sp_depends is , it will not show you tables/views which are not in current database. If you have used objects from other databases, this information might be misleading.
--By using sp_depends, You can provide Stored Procedure Name or View name as parameter
EXEC sp_depends '[dbo].[GetCustomer]'
SELECT DISTINCT OBJECT_NAME(SD.id) AS StoredProcedureNameName,
OB.name AS TableOrViewName
ON SD.id=O.id
ON SD.depid=OB.id
AND O.xtype='P'
--in a Stored Procedure
SELECT OBJECT_NAME(OBJECT_ID),definition
WHERE definition LIKE '%vw_Employee%'
Link to post:
How to Find if Table/View is used by Stored Procedure in SQL Server - SQL Server Interview Questions
SQL Views In 4 Minutes: Super Useful! Wow! Crazy! Amazing! I'm Crying Tears Of SQL Joy.
Retrieving a list of SQL Server objects (constraints, tables, views, functions) using sys.objects
SQL Server - Check to see if a table exists
SAP Tables - Finding tables associated with Tcodes
How To Check If Column Exists for a Table Or View in Database in SQL Server - SQL Server Tutorial
Tableau - View Data
Check Last Modified DateTime for An Object (Table,Stored Procedure,Trigger etc.) in SQL Server
how to see all tables in Oracle SQL | User Tables
SQL Views Tutorial | VIEWS in SQL Complete Tutorial
How to Search Table by Name in SQL Server
Quick Tutorial - Creating a View in SQL Server
View Serializability: A Tabular Form Example - Database
CAN'T FIND DATA IN DATA VIEW IN POWER BI?
Table views
[en] SQL Developer- How to find which tables reference a given table in Oracle SQL Developer?
I Never Want to Create React Tables Any Other Way
How I find a particular column name within all tables of SQL Database.
SAP ABAP: How to find which table/CDS VIEW is being read in a FIORI APP?
ABAP: How to Find a CDS View from a SAP Table ?
HOW TO JOIN 3 OR MORE TABLES IN SQL | TWO WAYS
Power BI - Matrix Visualization - move values from columns to rows
Fit a table in Word with text spreading outside page margins: Stop Table Row Breaking Across Pages
Giving Access on a Specific Table in Sql Server
Комментарии