Wednesday, March 21, 2012
Last Saved/modified date of Stored Procedures
Is there any way to find the "Last Saved Date" or "Last Modified Date" for a
SQL Stored Procedure? I have only found "Create Date" in SQL Enterprise
Manager.
Are Stored Procedures ever saved as files on the hard drive? If they are,
then maybe I could find the last saved date using Windows Explorer on the
SQL Server.
Any ideas for finding the Stored Procedure "Lst Saved Date", that don't
involve installing any software (that's not an option in this case)?
HI,
SQL Server will not save the modied date and time of any objects (Tables,
Views, procedures, triggers...).
Thanks
Hari
MCDBA
"J Baird" <jill[dot]baird[at]lmco[dot]com> wrote in message
news:eDjZlO$GEHA.3472@.TK2MSFTNGP11.phx.gbl...
> I'm not sure if this is the right newsgroup for this, but I took a
guess...
> Is there any way to find the "Last Saved Date" or "Last Modified Date" for
a
> SQL Stored Procedure? I have only found "Create Date" in SQL Enterprise
> Manager.
> Are Stored Procedures ever saved as files on the hard drive? If they are,
> then maybe I could find the last saved date using Windows Explorer on the
> SQL Server.
> Any ideas for finding the Stored Procedure "Lst Saved Date", that don't
> involve installing any software (that's not an option in this case)?
>
|||And in addition, no stored procedures aren't saved as files
on the hard drive - not unless you write scripts for the
stored procedures modifications and save those (which isn't
necessarily a bad idea). But SQL Server doesn't do anything
like that "behind the scenes".
If you want a new create date every time you modify a stored
procedure, you need to do a drop procedure and create
procedure instead of an alter procedure.
-Sue
On Tue, 6 Apr 2004 12:24:27 -0400, "J Baird"
<jill[dot]baird[at]lmco[dot]com> wrote:
>I'm not sure if this is the right newsgroup for this, but I took a guess...
>Is there any way to find the "Last Saved Date" or "Last Modified Date" for a
>SQL Stored Procedure? I have only found "Create Date" in SQL Enterprise
>Manager.
>Are Stored Procedures ever saved as files on the hard drive? If they are,
>then maybe I could find the last saved date using Windows Explorer on the
>SQL Server.
>Any ideas for finding the Stored Procedure "Lst Saved Date", that don't
>involve installing any software (that's not an option in this case)?
>
|||No there isn't. The only way currently to tell is if the sp was actually
dropped and recreated and then you could use the created date. Altering a
sp does not change this date.
Andrew J. Kelly SQL MVP
"J Baird" <jill[dot]baird[at]lmco[dot]com> wrote in message
news:eDjZlO$GEHA.3472@.TK2MSFTNGP11.phx.gbl...
> I'm not sure if this is the right newsgroup for this, but I took a
guess...
> Is there any way to find the "Last Saved Date" or "Last Modified Date" for
a
> SQL Stored Procedure? I have only found "Create Date" in SQL Enterprise
> Manager.
> Are Stored Procedures ever saved as files on the hard drive? If they are,
> then maybe I could find the last saved date using Windows Explorer on the
> SQL Server.
> Any ideas for finding the Stored Procedure "Lst Saved Date", that don't
> involve installing any software (that's not an option in this case)?
>
Monday, March 12, 2012
Last Entry in a Log
of this newsgroup, I apologize in advance for calling a relation a
table, using nulls, and other ignorant, destructive, and comtemptible
terminology.)
I have a table that's keeping a sort of running log of different types
of changes to pieces of data. The table has a foreign key of the data
being changed, the foreign key for the type of change occuring, some
information about the change in a couple more columns, and a timestamp
for each entry. So it's:
dataID
eventID
eventInfo
timestamp
What I'd like to do, if at all possible, is a single SQL query that,
given a dataID, returns the most recent eventInfo and timestamp for
each eventID. Is this possible?
Many thanks.
-Eric(eric404@.gmail.com) writes:
> I have a table that's keeping a sort of running log of different types
> of changes to pieces of data. The table has a foreign key of the data
> being changed, the foreign key for the type of change occuring, some
> information about the change in a couple more columns, and a timestamp
> for each entry. So it's:
> dataID
> eventID
> eventInfo
> timestamp
> What I'd like to do, if at all possible, is a single SQL query that,
> given a dataID, returns the most recent eventInfo and timestamp for
> each eventID. Is this possible?
SELECT a.eventID, a.eventInfo, a.timestamp
FROM tbl a
JOIN (SELECT eventID, timestamp = MAX(timestamp)
FROM tbl b
WHERE dataID = @.dataid)
GRUOP BY eventID) AS b ON a.eventID = b.eventID
AND a.timestamp = b.timestamp
WHERE a.dataID = @.dataid
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Is your "timestamp" column actually a DATETIME or SMALLDATETIME column? If
so, try the following query. Don't use the name "timestamp", which refers to
a different datatype in SQL Server. The TIMESTAMP datatype has nothing to do
with date and time so if your column is in fact a TIMESTAMP then you ought
to add a DATETIME column instead.
SELECT eventid, eventinfo, timestamp
FROM YourTable AS T
WHERE timestamp =
(SELECT MAX(timestamp)
FROM YourTable
WHERE eventid = T. eventid
AND dataid = @.dataid)
AND dataid = @.dataid ;
--
David Portas
SQL Server MVP
--|||Thanks for the help, it works great.