Created
August 5, 2025 15:20
-
-
Save felipeabajo/be3c9b1adddf7d6f80475f8c28caa225 to your computer and use it in GitHub Desktop.
References of a table in a BD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DECLARE @SearchText NVARCHAR(255) = 'table_name'; | |
| SELECT | |
| OBJECT_SCHEMA_NAME(sm.[object_id]) AS [Schema], | |
| OBJECT_NAME(sm.[object_id]) AS [ObjectName], | |
| o.type_desc AS [ObjectType], | |
| sm.[definition] AS [SQLDefinition] | |
| FROM sys.sql_modules sm | |
| INNER JOIN sys.objects o ON sm.[object_id] = o.[object_id] | |
| WHERE sm.[definition] LIKE '%' + @SearchText + '%' | |
| ORDER BY [Schema], [ObjectName]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment