DeepDive into SQL Server
Labels
Adhoc Queries
DB Concepts
SQL Server
SQL Server 2012
Monday, 26 May 2014
Query to find out list of tables which has a particular column....
Below query is used to find out the list tables which has particular column.
SELECT
OBJECT_NAME
(
OBJECT_ID
)
FROM
SYS
.
COLUMNS
SC
WHERE
NAME
LIKE
'%CUSTID%'
Finding out list of Stored Procedures which uses particular Table/Column....
So many times, while doing the impact analysis we need to find out the list of Stored procedures which uses a particular Table/Column.
Below query gives us the list stored procedures.
SELECT
OBJECT_NAME
(
SC
.
ID
),
TEXT
FROM
SYSCOMMENTS
SC
JOIN
SYSOBJECTS
SO
ON
SC
.
ID
=
SO
.
ID
WHERE
SC
.
TEXT
LIKE
'%CUSTID%'
AND
SO
.
TYPE
=
'P'
Newer Posts
Older Posts
Home
Subscribe to:
Posts (Atom)