MsSQL Find Usages Table Or Stored Procedure
今天在修改數隻(是這個隻還是這個支啊 '_')一、二年前撰寫的storedprocedure(T-SQL)後發現, 要找出這些被異動的SP曾在那些的SP裡面有使用,或者某張資料表在那幾隻SP內使用,這還真是一件苦差事。 此時突然想起Visual Studio 內有個功能叫 FindUsages ,可
今天在修改數隻(是這個"隻"還是這個"支"啊 '_>') 一、二年前撰寫的stored procedure(T-SQL)後發現,
要找出這些被異動的SP曾在那些的SP裡面有使用,或者某張資料表在那幾隻SP內使用,這還真是一件苦差事。
此時突然想起 Visual Studio 內有個功能叫 FindUsages ,可以方便的找出Function 曾在那些程式中使用,
花了一個上午的時間,寫出功能相仿的T-SQL版的 FindUsages
SQL ServerCREATE PROCEDURE [dbo].[sp_FindUsages] (@ObjectName SYSNAME) AS BEGIN SET NOCOUNT ON; CREATE TABLE #Result([Id] INT IDENTITY, [ObjectName] VARCHAR(100), [Line] INT,[Text] NVARCHAR(max)); DECLARE @Id INT; DECLARE @Line INT; DECLARE @Name NVARCHAR(1024); DECLARE pl CURSOR FOR SELECT [name] FROM sys.procedures; OPEN pl; FETCH NEXT FROM pl INTO @Name; WHILE @@FETCH_STATUS = 0 BEGIN EXEC ('INSERT INTO #Result ([Text]) EXEC sp_helptext ' + @Name); SET @line = 7; DECLARE r CURSOR FOR SELECT Id FROM #Result WHERE ObjectName IS NULL; OPEN r; FETCH NEXT FROM r INTO @Id; WHILE @@FETCH_STATUS = 0 BEGIN SET @Line = @line + 1; UPDATE #Result SET Line = @Line,ObjectName = @Name WHERE Id = @id ; FETCH NEXT FROM r INTO @Id; END CLOSE r; DEALLOCATE r; FETCH NEXT FROM pl INTO @Name; END CLOSE pl; DEALLOCATE pl; SELECT * FROM #Result WHERE [Text] LIKE '%' + @ObjectName + '%'; DROP TABLE #Result; END --exec [sp_FindUsages] [spName]

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Methods for php to connect to mssql database include using PHP's MSSQL extension, using PDO, etc. Detailed introduction: 1. Use PHP's MSSQL extension method to ensure that PHP has the MSSQL extension installed. You can check whether the mssql extension is enabled in the PHP configuration file (php.ini); 2. Use the PDO method to ensure that PHP has the PDO extension installed. You can check whether the pdo_sqlsrv extension is enabled in the PHP configuration file (php.ini).

Ubuntu is a popular open source operating system commonly used to run servers. Installing PHP and configuring MSSQL connections on Ubuntu is one of the operations that many developers and system administrators often need to do. This article will provide readers with a detailed guide, including the steps to install PHP, set up Apache, install MSSQLServer, etc., and attach specific code examples. Step 1: Install PHP and related extensions First, we need to install PHP and related extensions to support PHP connections

In this fast-paced era, OPPO Find X7 can use its imaging power to let us savor every beautiful moment in life. Whether it's magnificent mountains, rivers, lakes, or seas, warm family gatherings, or encounters and surprises on the street, it can help you record them with "unparalleled" picture quality. From the outside, the camera Deco design of Find It looks very recognizable and has a high-end feel. The inside is also unique, starting with the basic hardware configuration. FindX7 maintains the previous

Detailed steps for installing PHP to support MSSQL database in Ubuntu environment. When developing web applications, you often encounter situations where you need to connect to the Microsoft SQL Server (MSSQL) database. In the Ubuntu environment, to connect PHP to the MSSQL database, you need to install relevant software and configure appropriate settings. Next, we will introduce in detail the steps to install PHP to support MSSQL database in Ubuntu environment and provide specific code.

On August 22, a digital blogger revealed some core configuration information of OPPO Find X8 Ultra. According to the exposed content, this high-end model will be equipped with Qualcomm’s latest Snapdragon 8Gen4 mobile platform, equipped with a 6000mAh ultra-large capacity battery, and supports 100W wired fast charging and 50W wireless fast charging functions. Appearance design There is currently no specific design information about OPPO Find X8 Ultra. But the real picture of the standard version of OPPO Find X8 has been exposed on the Internet. Appearance of FindX8 Judging from the exposed photos, the rear camera module of OPPO FindX8 adopts a square design with a certain degree of curvature at the four corners, giving a more rounded feeling. In addition, the machine adopts a direct

What are the string search and replace techniques in Python? (Specific code example) In Python, strings are a common data type, and we often encounter string search and replace operations in daily programming. This article will introduce some common string search and replacement techniques, accompanied by specific code examples. To find a specific substring in a string, you can use the find() method or index() method of the string. The find() method returns the index of the first occurrence of the substring in the string.

During the traditional summer vacation "machine shortage", chat sites began to intensively break the news. On August 13, they successively released the OPPO Find Materials), Xiaomi 15Ultra (200 million pixel telephoto and shape) and several other revelations. We save + summarize the news about this batch of models: OPPO Find X8 and related products OPPO Find X8 and X8 Pro are expected to be released in November, while Find X8 Ultra will be released in the first quarter of 25. Dimensity 9400 processor FindX8 is close to a 6.6-inch domestic 1.5K direct screen, high-end and super

Installing PHP and connecting to MSSQL database under the Ubuntu operating system is one of the skills that many developers and system administrators need to master. This article will provide a detailed tutorial, including installing PHP, installing the MSSQL server driver, configuring PHP to connect to the MSSQL database, and providing corresponding code examples. Part One: Install PHP First, we need to install PHP and related extensions to be able to connect to the MSSQL database. Enter the following command in the terminal to install PHP and necessary extensions
