January 10, 2011 at 8:04 am
Hi,
Can anyone tell me, is there any query to find the path where the SQL server errorlog file is located?
By default it will be located to the below mentioned path. I want to get the path by query.
C:\Program Files\Microsoft SQL Server\MSSQL10_50.TESTINSTANCE\MSSQL\Log
Ryan
//All our dreams can come true, if we have the courage to pursue them//
January 10, 2011 at 8:57 am
First, the only way I know to do it is using an undocumented (read as: MS doesn't recommend you use it) extended stored procedure.
Look into xp_instance_regread
A quick way to see the use of it is to start a trace using the default trace template and then right-click on the server name and select properties. One of the very first items will include an xp_instance_regread, that gets the SQL root path, from that you can assume that you add "\Log" to the path and you are at the path the errorlog. There is another location that explicitly says where it is but I can't think of it right now..
CEWII
January 10, 2011 at 12:35 pm
sp_readerrorlog, look for the entry "Logging SQL Server messages in file "
Dan
January 10, 2011 at 1:24 pm
Create table #tmpRegValues ([Value] varchar(50), [Data] varchar(1000))
insert into #tmpRegValues
exec master..xp_instance_regenumvalues N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\Parameters'
Select @LogFolderName = substring(Data, 3,datalength(Data) - charindex('\',reverse(Data)) - 2)
from #tmpRegValues
where Data like '-e%'
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
January 10, 2011 at 1:48 pm
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply