Stored procedure changed date

  • Hello

    How can I know the date which the code of a stored procedure is changed?

    Regards

  • Drop and create are the only way without messing with the system tables. But then you have to redo permissions. Most folks just create a header in the SP and require it to be updated.

    Ex.

    /*-------------------------------------------

    - Purpose: Adjust from GMT to Eastern time zone.

    - Created On: 1/1/2002

    - Created By: Antares686

    -

    - Modified On: 2/1/2003

    - Modified By: Antares686

    - Reason: Invalid calc for time change.

    */

    Something that fits your needs and gives you what you want.

  • As stated, if you drop and re-create the SP then you can run the following to find the date it was created: -

    select crdate from sysobjects where name = 'SPNAME'

    (This field is not updated if you simply modify - from EM for example).

    Regards,

    Andy Jones

    .

  • In the sysobjects table there is a columns called schema_ver. BOL defines it like this:

    Version number that is incremented every time the schema for a table changes.

    If you keep track of this column value, then when it changes, means an object has been altered. You need to remember this column gets reset to 0 when an object is dropped and created.

    Basically there is no way easy to know when an SP has changed, but by building a process to track the value of schema_ver you should be able to tell when an object has been altered.

    Gregory Larsen, DBA

    If you looking for SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples

    Gregory A. Larsen, MVP

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply