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.
| Author |
Topic |
|
wonky donkey
Starting Member
15 Posts |
Posted - 2007-08-28 : 04:33:54
|
| Hi guys, wondering if someone could shed some light on this as i'm out of ideas! The code below is for a DDL trigger which fires on a particular database. It works fine and it currently updates the audit2 table. However, i'm struggling to find the correct functions (if they exist) to put in the select statement. The main one i'm searching for is a fucntion that recognises the created tables name. I've trawled through the TSQL function list abd there doesnt appear to be one. Can anyone suggest a good place to find these sorts of fuctions or know of ones i can use to solve my problem??thanksCODEUSE [Business]GOSET ANSI_NULLS OFFGOSET QUOTED_IDENTIFIER OFFGOALTER TRIGGER [Business_Audit]ON DATABASEFOR CREATE_TABLE AS DECLARE @rowcount INTINSERT dbo.Audit2 (AuditDate, SysUser, Application, [Rowcount], [TableName]) SELECT GetDate(), suser_sname(), APP_NAME(), @rowcount, null, GOSET ANSI_NULLS OFFGOSET QUOTED_IDENTIFIER OFFGOENABLE TRIGGER [Business_Audit] ON DATABASE |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-08-28 : 05:17:53
|
| look at the EVENTDATA() function.it holds the xml about the DDL event._______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
|
|
|