Is there a good way to tell who created a stored procedure in SQL Server 2005 (that also works in 2008)? In SQL Management Studio I can right mouse/properties on a proc to get the created date/time but how do I discover the creator?
相关问题
- sql execution latency when assign to a variable
- What is the best way to cache a table from a (SQL)
- php PDO::FETCH_ASSOC doesnt detect select after ba
- Bulk update SQL Server C#
- SQL to Parse a Key-Value String
相关文章
- Entity Framework 4.3.1 failing to create (/open) a
- Code for inserting data into SQL Server database u
- How do I append metadata to an image in Matlab?
- Delete Every Alternate Row in SQL
- Linux based PHP install connecting to MsSQL Server
- SQL Azure Reset autoincrement
- What file sytems support Java UserDefinedFileAttri
- How do we alias a Sql Server instance name used in
Along the same idea as Sam's, you could use a DDL trigger to capture the needed information, then send that data to a SQL Service broker queue, which could forward it to the Admin database (which could be on another server if needed) which would then hold all the DDL changes.
This would remove the permissions issue as the DDL trigger would be loading data into a Service Broker Queue at the local database and SQL handles the moving of the message to the other database.
There would be a bit more setup with this method, but once setup it would work no matter who made the object change.
It may be too late for you now, but you can keep track of DDL activity.
We have a table in our administrative database that gets all the activity put in it. It uses a DDL trigger, new to 2005. These scripts create a table in your admin DB (SQL_DBA for me), create a trigger on the model db, create triggers on existing databases. I also created a sp_msforeachDB statement at the end to disable all of them.
One caveat - your databases need to be in compatibility mode of 90(in options for each db), otherwise you may start getting errors. The account in the EXECUTE AS part of the statement also needs access to insert into your admin table.
If it was not created too long ago, try this:
It selects the current (out of the box) default trace. If it was created recently (and the server hasn't been restarted recently), then the stored procedure object name and the login name that created it will be in the trace data.
How to get this piece of info ex post (especially years later) is most likely not possible.
However, you can use SQL Server Profiler to track DDL actions. In Event Selection, check the following events:
Objects / Object: Altered
Objects / Object: Created
Objects / Object: Deleted
There are also lots of customization options: you can save the output to a file or table, filter the output furthermore based on any columns etc. etc.
I believe this is not available in SQL 2005. Certainly it's not available in the properties in SQL Management Studio, and not available in the sys.objects table or any others I can see.