Undocumented stored procedures
Thanks to Manuj Bahl for this:
SQL Server - Extended Stored Procs
SQL Servers has some undocumented extended stored procedures that can be really useful in certain cases.
I was searching google for T-SQL code to find out free space left on the drives. I not only found that .. but when I looked into the master database ... found out a lot of undocumented stored procs I never knew about. Using this blog to document and serve as a reference later.
xp_getfiledetails
This procedure returns the following information about an existing file.
Alternate Name, Size, Creation Date, Creation Time, Last Written Date, Last Written Time, Last Accessed Date, Last Accessed Time, Attributes
xp_dirtree
This extended stored procedure brings out the directory tree of the drive you pass to it as parameter with depth and Folder name.
xp_fixeddrives
Returns free space in the fixed drives on the server in MB.
xp_fileexist
Gives the following resultset
File Exists [bit], File Is A Directory [bit], Parent Directory Exists [bit]
xp_enumgroups
Returns the User Groups on the Server
xp_availiblemedia
Free Space on the drives in bytes.
xp_enumdsn
List of DSN configued on the server.