Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How Can I know who had created the table in my DB?

Author  Topic 

sunnykj
Starting Member

29 Posts

Posted - 2005-12-20 : 23:28:04
How Can I know who had created the table in my DB?
May I log it?

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2005-12-21 : 06:41:30
1. you can't if it's already there.

2. you can if it's not there, by restricting access to create tables to a restricted few...via proper use of the dbRoles.
or using PROFILER.

3. in 2005 (maybe 2k aswell) I think you can create triggers on DDL statements...those in the know may be able to put me right on this.
Go to Top of Page

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2005-12-21 : 06:54:47
Yes in 2005 - you can create a trigger on DDL Statements - From 2005 Books On Line:
--*********************************************************************************************************
Trigger on a CREATE, ALTER, DROP, GRANT, DENY, REVOKE, or UPDATE STATISTICS statement (DDL Trigger)
CREATE TRIGGER trigger_name
ON { ALL SERVER | DATABASE }
[ WITH <ddl_trigger_option> [ ,...n ] ]
{ FOR | AFTER } { event_type | event_group } [ ,...n ]
AS { sql_statement [ ; ] [ ...n ] | EXTERNAL NAME < method specifier > [ ; ] }

<ddl_trigger_option> ::=
[ ENCRYPTION ]
[ EXECUTE AS Clause ]

<method_specifier> ::=
assembly_name.class_name.method_name
--***************************************************************************************

Duane.
"It's a thankless job, but I've got a lot of Karma to burn off."
Go to Top of Page

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2005-12-21 : 07:07:15
Oh... and another way to identify ddl changes is by using an auditing tool - like Idera - who advertise on this site. [url]http://www.idera.com/Default.aspx[/url], If you are interested - wait for there advert to appear on the site rather than clicking on the link - I think Graz gets money for each time somebody clicks on the ad

Duane.
"It's a thankless job, but I've got a lot of Karma to burn off."
Go to Top of Page
   

- Advertisement -