Sunday, February 19, 2012

DatabaseLog table

AdventureWorks database has tables: DatabaseLog, ErrorLog. I figured there should be a system stored procedure that creates such tables for your database. So far I could not find what it is. I would appreciate a pointer.

Thanks.

hi,

AlexBB wrote:

AdventureWorks database has tables: DatabaseLog, ErrorLog. I figured there should be a system stored procedure that creates such tables for your database. So far I could not find what it is. I would appreciate a pointer.

Thanks.

those tables are not system table but user tables...

dbo.ErrorLog has a dependency chain including dbo.uspLogError stored procedure, 9 triggers and more 3 stored procedures, HumanResources.uspUpdateEmployeeInfo, HumanResources.uspUpdateEmployeeLogin and HumanResources.uspEmployeePersonalInfo, while dbo.DatabaseLog is referenced by a database trigger, ddlDatabaseTriggerLog...

regards

|||

Andrea Montanari wrote:

hi,

AlexBB wrote:

AdventureWorks database has tables: DatabaseLog, ErrorLog. I figured there should be a system stored procedure that creates such tables for your database. So far I could not find what it is. I would appreciate a pointer.

Thanks.

those tables are not system table but user tables...

dbo.ErrorLog has a dependency chain including dbo.uspLogError stored procedure, 9 triggers and more 3 stored procedures, HumanResources.uspUpdateEmployeeInfo, HumanResources.uspUpdateEmployeeLogin and HumanResources.uspEmployeePersonalInfo, while dbo.DatabaseLog is referenced by a database trigger, ddlDatabaseTriggerLog...

regards

Andrea, I never doubted that those tables are user tables. I've never said otherwise.

My question was "how to set up a log table for an arbitrary user database?"

|||As far as I can remember those tables, these are just tables for a generic error solution in SQL Server 2005 which can be download as a sample at the MSDN sites.

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de|||

hi,

Jens is right about the "general logging" purpose...

if you like you can script those objects out... try having a look at my amScript free project, that can script out even the database trigger so that you can inspect the relative DDL code..

regards

|||

Andrea Montanari wrote:

hi,

Jens is right about the "general logging" purpose...

if you like you can script those objects out... try having a look at my amScript free project, that can script out even the database trigger so that you can inspect the relative DDL code..

regards

Thank you, Andrea and Jens. Andrea's websites are very helpful. I have already downloaded some code.