Category: Stored Procedures

How to Rename a Table in SQL Server?

Hello to everyone, In this article, I will provide information on how to rename a table name in SQL Server. In SQL Server you may want to rename the table name in some cases. You can easily do this using the code below. exec sp_rename ‘dbo.Categories’, ‘NewCategoryName’ I made my...

How to Find Table Used in Stored Procedure in SQL Server

Hello to everyone, In this article, I will talk about how to find tables related to Procedures in SQL Server. You can also do this using the code below. SELECT obj.[name] AS ‘ProcedureName’, sed.referenced_entity_name AS ‘TableName’ FROM sys.objects AS obj INNER JOIN sys.sql_expression_dependencies AS sed ON obj.object_id = sed.referencing_id WHERE...

Find Stored Procedure Related to Table in SQL Server

Hello to everyone, In this article, I will talk about how to find the tables used by Stored procedures in SQL Server. You can easily do this using the code below. DECLARE @temptableforSP TABLE ( spName VARCHAR(100), tableName NVARCHAR(100) ); DECLARE @SP_Name AS NVARCHAR(100); DECLARE @SP_Cursor AS CURSOR; SET @SP_Cursor...

Don`t copy text!