Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 149997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:13:12+00:00 2026-05-11T09:13:12+00:00

Is there a good way to tell who created a stored procedure in SQL

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T09:13:13+00:00Added an answer on May 11, 2026 at 9:13 am

    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.

    USE [SQL_DBA] GO /****** Object:  Table [dbo].[DDL_Login_Log]    Script Date: 03/03/2009 17:28:10 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[DDL_Login_Log](     [DDL_Id] [int] IDENTITY(1,1) NOT NULL,     [PostTime] [datetime] NOT NULL,     [DB_User] [nvarchar](100) NULL,     [DBName] [nvarchar](100) NULL,     [Event] [nvarchar](100) NULL,     [TSQL] [nvarchar](2000) NULL,     [Object] [nvarchar](1000) NULL,  CONSTRAINT [PK_DDL_Login_Log] PRIMARY KEY CLUSTERED  (     [DDL_Id] ASC,     [PostTime] ASC )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY] ) ON [PRIMARY] -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- --This creates the trigger on the model database so all new DBs get it USE [model] GO /****** Object:  DdlTrigger [ddl_DB_User]    Script Date: 03/03/2009 17:26:13 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TRIGGER [ddl_DB_User]  ON DATABASE FOR DDL_DATABASE_SECURITY_EVENTS AS   DECLARE @data XML declare @user nvarchar(100)  SET @data = EVENTDATA() select @user = convert(nvarchar(100), SYSTEM_USER)  execute as login='domain\sqlagent' INSERT sql_dba.dbo.DDL_Login_Log     (PostTime, DB_User, DBName, Event, TSQL,Object)     VALUES     (@data.value('(/EVENT_INSTANCE/PostTime)[1]', 'nvarchar(100)'),     @user,     db_name(),     @data.value('(/EVENT_INSTANCE/EventType)[1]', 'nvarchar(100)'),     @data.value('(/EVENT_INSTANCE/TSQLCommand/CommandText)[1]','nvarchar(max)'),     @data.value('(/EVENT_INSTANCE/ObjectName)[1]', 'nvarchar(1000)') )  GO SET ANSI_NULLS OFF GO SET QUOTED_IDENTIFIER OFF GO   -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- --CREATE TRIGGER IN ALL NON SYSTEM DATABASES  DECLARE @dataname varchar(255), @dataname_header varchar(255), @command VARCHAR(MAX), @usecommand VARCHAR(100) SET @command = ''; DECLARE datanames_cursor CURSOR FOR SELECT name FROM sys.databases  WHERE name not in ('master', 'pubs', 'tempdb', 'model','msdb') OPEN datanames_cursor FETCH NEXT FROM datanames_cursor INTO @dataname WHILE (@@fetch_status = 0) BEGIN  PRINT '----------BEGIN---------'  PRINT 'DATANAME variable: ' + @dataname;  EXEC ('USE ' + @dataname);  PRINT 'CURRENT db: ' + db_name();  SELECT @command = 'CREATE TRIGGER DBA_Audit ON DATABASE FOR DDL_DATABASE_LEVEL_EVENTS AS DECLARE @data XML DECLARE @cmd NVARCHAR(1000) DECLARE @posttime NVARCHAR(24) DECLARE @spid NVARCHAR(6) DECLARE @loginname NVARCHAR(100) DECLARE @hostname NVARCHAR(100) SET @data = EVENTDATA() SET @cmd = @data.value(''(/EVENT_INSTANCE/TSQLCommand/CommandText)[1]'', ''NVARCHAR(1000)'') SET @cmd = LTRIM(RTRIM(REPLACE(@cmd,'''',''''))) SET @posttime = @data.value(''(/EVENT_INSTANCE/PostTime)[1]'', ''DATETIME'') SET @spid = @data.value(''(/EVENT_INSTANCE/SPID)[1]'', ''nvarchar(6)'') SET @loginname = @data.value(''(/EVENT_INSTANCE/LoginName)[1]'',     ''NVARCHAR(100)'') SET @hostname = HOST_NAME() INSERT INTO [DBA_AUDIT].dbo.AuditLog(Command, PostTime,HostName,LoginName)  VALUES(@cmd, @posttime, @hostname, @loginname);'   EXEC (@command);  FETCH NEXT FROM datanames_cursor INTO @dataname; PRINT '----------END---------' END CLOSE datanames_cursor DEALLOCATE datanames_cursor  -------------------------------------------------------------------------------- --------------------------------------------------------------------------------  ----Disable all triggers when things go haywire sp_msforeachdb @command1='use [?]; IF  EXISTS (SELECT * FROM sys.triggers WHERE name = N''ddl_DB_User'' AND parent_class=0)disable TRIGGER [ddl_DB_User] ON DATABASE' 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a good way to get the debug information that Django provides when
Can someone please tell me if there is a good (easy) way to visualize
Is there any good way of truncating text with plain HTML and CSS, so
Is there a good way in asp.net MVC to trace ModelState errors? IsValid returns
Is there a good way in C# to mimic the following python syntax: mydict
Is there a good way to test whether I am logging into a text
Is there a good way to debug exited with code 5 runtime error on
Is there a good way to keep consistency in the $_GET For example if
Is there a good way to detect deletes in Java? I know I can
Is there a good way to map and ( select or delete_if ) at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.