开发者

What is the SQL query to return the SQL error log configuration?

What is the SQL query to return the SQL error log configuration开发者_如何学JAVA?


From running SQL Profiler whilst viewing that option in Management Studio it appears to be stored in the registry. The below is what I got. It returns NULL if I have the "limit the number of error log files..." option unchecked or the number otherwise.

If it doesn't work for you you might want to try the same thing on your instance to see if the paths are any different.

declare @HkeyLocal nvarchar(18)
declare @MSSqlServerRegPath nvarchar(31)
declare @InstanceRegPath sysname

select @HkeyLocal=N'HKEY_LOCAL_MACHINE'

-- Instance-based paths
select @MSSqlServerRegPath=N'SOFTWARE\Microsoft\MSSQLServer'
select @InstanceRegPath=@MSSqlServerRegPath + N'\MSSQLServer'

declare @NumErrorLogs int
exec master.dbo.xp_instance_regread @HkeyLocal, @InstanceRegPath, N'NumErrorLogs', @NumErrorLogs OUTPUT
select @NumErrorLogs
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜