info@techdevops.com | 437-991-3573 | Data Engineering Services
TechDevOps.com
Resources Tools
Experts in Microsoft SQL Server on Windows, Linux, Containers | Clusters, Always On, FCI | Migrations, Cloud, Performance



T-SQL - Get Stored Procedure Created and Modified Dates
by BF (Principal Consultant; Architecture; Engineering)
2017-08-18









T-SQL - Get Stored Procedure Created and Modified Dates:


Declare @spname sysname = NULL
--Set @spname = 'sprGetClients'

--Method #1:
SELECT
Name as 'SP Name',
create_date as 'Created Date',
modify_date as 'Modified Date'
FROM
sys.objects
WHERE type = 'P'
and (@spname is null or name like '%' + @spname + '%')
order by create_date desc

--Method #2:
SELECT
routine_name as 'SP Name',
created as 'Created Date',
last_altered as 'Modified Date'
FROM
INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_TYPE = N'PROCEDURE' and ROUTINE_SCHEMA = N'dbo'
and (@spname is null or routine_name like '%' + @spname + '%')
order by created desc