While there are tons of undocumented T-SQL commands out there, one of my all-time favorites is this little gem:
T-SQL
SELECT SERVERPROPERTY('ErrorLogFileName');
It’s not much, but it will show you default details on:
-
Where the SQL Server Binaries have been installed
-
Where you can find SQL Server’s log files (as .txt files)
-
Where the default trace (.trc) files are located
![]()
Arguably, there are better ways to retrieve some of this information (like SELECT * FROM sys.dm_server_registry;).
But SERVERPROPERTY(‘ErrorLogFileName’) works just fine when looking for low-level details.
The only real problem I have with this particular snippet of T-SQL is that I can never remember EXACTLY what the property is to ‘search’ for (i.e., ‘ErrorLogFileName’) – which is part of why I’ve blogged about it (so that I’ll be able to more easily find this snippet in the future).