Is there a way to locate the SQL Server data directory using T-SQL? For MSDE customers, I want to implement a one-click backup, and that involves knowing which directory to put the backup in. I would prefer to put it in or relative to the data directory (or some other SQL Server directory). If I don't specify a directory, the backup file is put in the Windows System32 directory.
Any suggestions would be appreciated. Thanks.