Read Last 7 Days Erro Log with xp_ReadErrorLog


declare @dt1 datetime=getdate()-7
declare @dt2 datetime=getdate()

EXEC xp_ReadErrorLog 0, 1, N’error’, N”,@dt1,@dt2

—-Or Failed Login
–EXEC xp_ReadErrorLog 0, 1, “Failed”, “Login”,@dt1,@dt2

—-****** the syntax with double quotes “Failed”

(Script above was  on SQL Server 2014)

Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s