Help - improve the T-SQl code help needed

  • The following code does work and it will search across all databases in the SERVER looking for an object that matches the name ( spPrepareStratificationExtract ).
    Good!  Now what I need is to be able to search for any object that was created by a certain user. This is where I need the help, Thanks!


    EXEC sp_MSforeachdb 'SELECT ''?'' + ''.'' + B.name + ''.'' + A.name as Object_Name , A.type, A.create_date
    FROM [?].sys.objects A inner join [?].sys.schemas B on ( A.schema_id = B.schema_id ) 
    WHERE A.name like ''%spPrepareStratificationExtract%'''

  • The system doesn't store who did the creates of the objects.  You will need to setup audit(s) to capture that information.  This information may (again, may) be in the default trace or extended events session.

Viewing 2 posts - 1 through 1 (of 1 total)

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