Hi Joel,
Keep in mind that each DB can be located in it's own directory or even in multiple directories. The following select will return directory for the primary filegroup for each DB.
SELECT name, filename,
REVERSE(SUBSTRING(REVERSE(filename), CHARINDEX('\', REVERSE(filename)), 4000))
FROM master.dbo.sysdatabases
>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.
--sb--