How to Use System Diagnostic Discovery Services in.How to use Customization Analysis tool in Microsof.How to use Issue Search Tool in Microsoft Dynamics.How to use Upgrade Analysis Tool in Microsoft Dyna.How to build a Package to upload a business proces.How to apply Task Recorder hotfix for Advance reco.Get SQL Server Agent Jobs List with Schedule in SQ.Get all Triggers with Table Names in SQL Server.How to Drop or Delete all Triggers from a Database.Create Trigger on Temp Tables and System Tables in.How to get list of All Disabled/Enabled Triggers i.How to Disable All the Triggers in SQL Server Data.How to Enable Multiple Triggers in SQL Server Data.How to get Decimal/Float Output from Integers Divi.How to find String in All Stored Procedures in SQL.Get all Tables with Column Names and Data types fr.How to get Table Names with Record Count in SQL Se.How to Search Text in Steps of SQL Server Agent Jobs.What are the different ways to set value of a Var.How to create Database Snapshot - SQL Server DBA T.SQL Server 2014 Create Database Best Practices - S.How to Take Database Offline and Bring it Online.How to Shrink Database And Database Files - SQL Se.How to Create Database in SQL Server 2014 - SQL Se.How to Attach and Detach Databases - SQL Server DB.SELECT OBJECT_NAME ( OBJECT_ID ), definition Use sys.all_sql_modules system view to get information if table is used ![]() The definition column of this view has definition of Stored Procedure, Views, Functions etc.You can write query as given below to check if any of the Stored Procedure or object is using the table/view you are looking for. SELECT DISTINCT OBJECT_NAME ( SD.id ) AS StoredProcedureNameName ,įROM sys.sysdepends SD INNER JOIN sys.sysobjects Oģrd method is to use the sys.all_sql_modules system view. It will not show you cross database objects ( Tables,Views) if have used in Stored Procedure or view definition. ![]() The 2nd method is to use the sys.sysdepends view with combination of sys.sysobjects to get the information. By using sp_depends, You can provide Stored Procedure Name or View name as parameter If you have used objects from other databases, this information might be misleading. One disadvantage of using sp_depends is, it will not show you tables/views which are not in current database. You can pass the view name or Stored Procedure as parameter,it will return you tables/views which are used in the object. This System Stored Procedure will return you list of table/views used by the Stored procedure/View. In this post, we are going to learn how to find out if the table is used in a Stored Procedure.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |