Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

SQL Server Get Created, Last Modified date of Stored Procedure or Table

Oct 25, 2012
Introduction:

In this article I will explain how to find or get last modified date and created date of stored procedure or table in SQL server.
Description:
In previous articles I explained difference between function and stored procedures, joins in SQL Server, substring function in SQL server and many articles relating to SQL server. Now I will explain how to get last modified date or created date of stored procedure or table in SQL server.

To get created date or last modified date of stored procedure we need to write the query like this


SELECT name,type,type_desc,create_date,modify_date FROM sys.objects
WHERE type = 'P' AND name = 'YourProcedureName'
Here if you observe above query I mentioned type = 'P' this mean to identify stored procedure or table or function etc based on 'P','U','FN',etc…

Here type = 'P'   (Procedure)
        type = 'U'  (User Table)
        type = 'S'  (System Table)
        type = 'PK' (Primary Key)
        type = 'FN' (Scalar Function)

Suppose if we want to get modified or created date of table we need to mention type = 'U' and the query will be like this


SELECT name,type,type_desc,create_date,modify_date FROM sys.objects
WHERE type = 'U' AND name = 'YourTableName'
Example:


SELECT name,[type],type_desc,create_date,modify_date FROM sys.objects
WHERE [type] = 'P' AND name = 'GetUserDetails'
Output:



If you enjoyed this post, please support the blog below. It's FREE!

Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

5 comments :

Vinay said...

Really nice but i have a dought


i create one stored procedure

i altered that stored procedure

now i want to stored procedure before altered

how can i get that stored procedure

Please Provide a Solution Please.....


Thanks & Regards
Vinay Kumar

Suresh Dasari said...

@vinay...
If you are maintain the backup for your database then only u have chance to get old procedure otherwise it's not possible.

Unknown said...

how can i get values into dropdownlist from sql using stored procedure

Anonymous said...

alya chacka
atlu pan nahi avdtu !!
to su karva avta hasho ????
aena karta chod do . bka chaka!!!!
For special Ajesh Chacko Chacko.....

gaurav rawat said...

Hi Suresh,
Very nice blog i got my answer of my problem from ur blog. Thanks!!

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 2015 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.