Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Determine when a Stored Procedure was created and last altered


Determine when a Stored Procedure was created and last altered

Author
Message
oradbguru
oradbguru
SSC-Enthusiastic
SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)

Group: General Forum Members
Points: 121 Visits: 292
Comments posted to this topic are about the item Determine when a Stored Procedure was created and last altered
m mcdonald
m mcdonald
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1787 Visits: 1668
You can also use

select o.name as ProcedureName
, db_name(parent_object_id) as DatabaseName
-- , sm.definition
, o.create_date as CreateDate
, o.modify_date as LastAlteredDate
from sys.sql_modules sm
inner join sys.objects o on sm.object_id = o.object_id



Benefit is the definition here is nvarchar(max) whereas in information_schema.routines it is nvarchar(4000)

Cheers
j-1064772
j-1064772
SSC-Addicted
SSC-Addicted (439 reputation)SSC-Addicted (439 reputation)SSC-Addicted (439 reputation)SSC-Addicted (439 reputation)SSC-Addicted (439 reputation)SSC-Addicted (439 reputation)SSC-Addicted (439 reputation)SSC-Addicted (439 reputation)

Group: General Forum Members
Points: 439 Visits: 1202
Actually I would prefer to know the LAST TIME the procedure was run and by whom, in order to determine which ones have become unused fossils.

Any plans to upgrade your script to provide this ?

webtomte
webtomte
SSC Journeyman
SSC Journeyman (99 reputation)SSC Journeyman (99 reputation)SSC Journeyman (99 reputation)SSC Journeyman (99 reputation)SSC Journeyman (99 reputation)SSC Journeyman (99 reputation)SSC Journeyman (99 reputation)SSC Journeyman (99 reputation)

Group: General Forum Members
Points: 99 Visits: 226
THis is also useful. Shows not only sprocs

SELECT DISTINCT
name
,type
,type_desc
,create_date
,modify_date
FROM
sys.objects
WHERE
type IN ('P','PK','F','D','FN','TR','UQ','X')
ORDER BY
type
,modify_date DESC
PHYData DBA
PHYData DBA
SSChasing Mays
SSChasing Mays (613 reputation)SSChasing Mays (613 reputation)SSChasing Mays (613 reputation)SSChasing Mays (613 reputation)SSChasing Mays (613 reputation)SSChasing Mays (613 reputation)SSChasing Mays (613 reputation)SSChasing Mays (613 reputation)

Group: General Forum Members
Points: 613 Visits: 534
j-1064772 (1/15/2014)
Actually I would prefer to know the LAST TIME the procedure was run and by whom, in order to determine which ones have become unused fossils.

Any plans to upgrade your script to provide this ?


Wow... Bossy and un-informed.
That kind of information is not provided in the SQL server schema data which is what this script is about.
You would need to create a different script to monitor execution in the active trace real time.
Better idea for you and your production system would be to check out SQL Server Performance Monitor and run a trace. Cool
PHYData DBA
PHYData DBA
SSChasing Mays
SSChasing Mays (613 reputation)SSChasing Mays (613 reputation)SSChasing Mays (613 reputation)SSChasing Mays (613 reputation)SSChasing Mays (613 reputation)SSChasing Mays (613 reputation)SSChasing Mays (613 reputation)SSChasing Mays (613 reputation)

Group: General Forum Members
Points: 613 Visits: 534
Thanks for this.
I had been looking for something that did not require access to the current trace file to show this data.
Iwas Bornready
Iwas Bornready
SSCrazy Eights
SSCrazy Eights (9.8K reputation)SSCrazy Eights (9.8K reputation)SSCrazy Eights (9.8K reputation)SSCrazy Eights (9.8K reputation)SSCrazy Eights (9.8K reputation)SSCrazy Eights (9.8K reputation)SSCrazy Eights (9.8K reputation)SSCrazy Eights (9.8K reputation)

Group: General Forum Members
Points: 9752 Visits: 885
Nice little script. Thank you.
Iwas Bornready
Iwas Bornready
SSCrazy Eights
SSCrazy Eights (9.8K reputation)SSCrazy Eights (9.8K reputation)SSCrazy Eights (9.8K reputation)SSCrazy Eights (9.8K reputation)SSCrazy Eights (9.8K reputation)SSCrazy Eights (9.8K reputation)SSCrazy Eights (9.8K reputation)SSCrazy Eights (9.8K reputation)

Group: General Forum Members
Points: 9752 Visits: 885
Now that I've used it I like it even better. Thanks again.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search