Database reference - AdventureWorks

AdventureWorks -  tables -  [dbo].[ErrorLog]

Description

Audit table tracking errors in the the AdventureWorks database that are caught by the CATCH block of a TRY...CATCH construct. Data is inserted by stored procedure dbo.uspLogError when it is executed from inside the CATCH block of a TRY...CATCH construct. 

Table properties

namevalue
name[dbo].[ErrorLog]
createdMar 19 2009 9:08PM
modifiedMar 19 2009 9:08PM 
ansi nullson 
quoted identifieron 
row count
Size of data0 kb
Size of indexes0 kb
Maximum size of a single row16,788 bytes

Columns

columndatatypelengthbytesdefaultnullsPKFKUQcomputedcomment
ErrorLogIDint identity(1,1)104 no  yes    no  Primary key for ErrorLog records. 
ErrorTimedatetime238(getdate())no      no  The date and time at which the error occurred. 
UserNamesysname128256 no      no  The user who executed the batch in which the error occurred. 
ErrorNumberint104 no      no  The error number of the error that occurred. 
ErrorSeverityint104 yes      no  The severity of the error that occurred. 
ErrorStateint104 yes      no  The state number of the error that occurred. 
ErrorProcedurenvarchar(126)126504 yes      no  The name of the stored procedure or trigger where the error occurred. 
ErrorLineint104 yes      no  The line number at which the error occurred. 
ErrorMessagenvarchar(4000)400016000 no      no  The message text of the error that occurred. 

Indexes

namedescriptioncolumncomment
PK_ErrorLog_ErrorLogIDclustered, unique, primary key located on PRIMARYErrorLogIDClustered index created by a primary key constraint. 

Defaults

default namecolumncomment
DF_ErrorLog_ErrorTimeErrorTimeDefault constraint value of GETDATE() 

Dependency graph

DF_ErrorLog_ErrorTimeErrorLogPK_ErrorLog_ErrorLogIDuspLogError

Objects that depend on [dbo].[ErrorLog]

nameobject typelevel
uspLogErrorstored procedure1
uSalesOrderHeadertrigger2
iStoretrigger2
iduSalesOrderDetailtrigger2
uPurchaseOrderHeadertrigger2
uPurchaseOrderDetailtrigger2
iPurchaseOrderDetailtrigger2
dVendortrigger2
uWorkOrdertrigger2
iWorkOrdertrigger2
uspUpdateEmployeePersonalInfostored procedure2
uspUpdateEmployeeLoginstored procedure2
uspUpdateEmployeeHireInfostored procedure2

Code

CREATE TABLE [dbo].[ErrorLog](
    [ErrorLogID] [int] IDENTITY(1,1) NOT NULL,
    [ErrorTime] [datetime] NOT NULL,
    [UserName] [sysname] COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
    [ErrorNumber] [int] NOT NULL,
    [ErrorSeverity] [int] NULL,
    [ErrorState] [int] NULL,
    [ErrorProcedure] [nvarchar](126) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
    [ErrorLine] [int] NULL,
    [ErrorMessage] [nvarchar](4000) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
 CONSTRAINT [PK_ErrorLog_ErrorLogID] PRIMARY KEY CLUSTERED 
(
    [ErrorLogID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

ALTER TABLE [dbo].[ErrorLog] ADD  CONSTRAINT [DF_ErrorLog_ErrorTime]  DEFAULT (getdate()) FOR [ErrorTime]

Powered by Yoyodyne © 1971