Wednesday, March 28, 2012

Is there a place where i can find the events that takes place in sql server?

Is there a place where i can find events that takes place in the sql server? Like adding data to a database or something like that....

Regards

Karen

Sure. Triggers. What did you have in mind?

>L<

|||something like a log file that keeps track of things that have inserted, updated or deleted from the Dbase|||

You can write triggers on both a table- and database- level for that. You decide what events you want to capture, and what detail. I typically write to a table, I suppose most people do. If you have a targeted requirement (IOW, you don't just want "every" event, you have a goal in mind), you should look into doing this. If you have trouble understanding how to write the trigger when the event applies across multiple rows, holler, although this is really not the right forum for that discussion <s>.

Events that change data are also logged automatically, even if they are not in transactions. You can get some information out using third party tools -- see this thread http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1423816&SiteId=1.

You can also use DBCC LOGINFO (see an old article http://www.mssqlcity.com/Articles/KnowHow/ViewLog.htm and a slightly better one here http://www.sqlservercentral.com/columnists/achigrik/sqlserver7someusefulundocumenteddbcccommands.asp#part_2_8) but it may not get you where you're going.

>L<

No comments:

Post a Comment