Users: 30k; Pages Per Session: 2.5p; Avg. Session Duration: 1:35mi
TechDevOps.com
Explore Tools
{Featuring Microsoft Technologies + Enterprise Data + Cloud Computing}



T-SQL - Get Stored Procedure Created and Modified Dates
by BFarrell (Senior MSSQL Operations - Enterprise, Cloud, Strategy)
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