Query to get last modified procedures or table names in sql server

These are the some basic sql queries which helps during the development process.

In order to get top 10 procedures names which are modified recently you can use

SELECT top(10)OBJECT_NAME(object_id) as name,modify_date,type_desc,create_date FROM sys.objects
WHERE type = ‘P’

 Gives you last 10 modified procedure names

SELECT top(10)OBJECT_NAME(object_id) as name,modify_date,type_desc,create_date FROM sys.objects
WHERE type = ‘U’query1

Gives you last 10 modified table names

In order to know how much space consumed by your table use

SP_SPACEUSED  ‘Your table name’ query

To modify or open text of any procedure use

SP_HELPTEXT ‘Your Procedure Name’

If you want to see the design of the table let say Products, select table and press ALT + F1

query2

To execute the query execution plan press CTRL + M

For more keyboard short cuts and commands please refer following url:

http://msdn.microsoft.com/en-us/library/ms174205.aspx

Thank you!

Advertisements

One comment

  1. Object type:
    AF = Aggregate function (CLR)
    C = CHECK constraint
    D = DEFAULT (constraint or stand-alone)
    F = FOREIGN KEY constraint
    FN = SQL scalar function
    FS = Assembly (CLR) scalar-function
    FT = Assembly (CLR) table-valued function
    IF = SQL inline table-valued function
    IT = Internal table
    P = SQL Stored Procedure
    PC = Assembly (CLR) stored-procedure
    PG = Plan guide
    PK = PRIMARY KEY constraint
    R = Rule (old-style, stand-alone)
    RF = Replication-filter-procedure
    S = System base table
    SN = Synonym
    SO = Sequence object
    SQ = Service queue
    TA = Assembly (CLR) DML trigger
    TF = SQL table-valued-function
    TR = SQL DML trigger
    TT = Table type
    U = Table (user-defined)
    UQ = UNIQUE constraint
    V = View
    X = Extended stored procedure

    Just for the reference

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: