Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL 2005 Find Out Who Created a View

Does SQL store any information about who originally created a view, or who last modified it?

like image 718
hilary Avatar asked Sep 08 '25 01:09

hilary


2 Answers

It's too late now, but if you were using 2008 you could create an audit that will track future changes.

EDIT: found it!

    select p.name, v.* 
from sys.all_views v, sys.database_principals p, sys.schemas s
where p.principal_id = s.principal_id
and v.schema_id = s.schema_id
and v.name = 'your_view_name'

This will produce a number of interesting details about the views in your database, including the column principal_id. Join with sys.database_principals on principal_id for the username!

like image 188
Chris McCall Avatar answered Sep 10 '25 02:09

Chris McCall


I am not sure if there is a way to see who created the view but sp_help will get you some information on when it was created

sp_help viewMyView

sp_help works on any and all database objects BTW.

like image 30
Jon Erickson Avatar answered Sep 10 '25 01:09

Jon Erickson