Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Location of data directory
Message
 
 
To
05/09/2003 08:54:48
Joel Leach
Memorial Business Systems, Inc.
Tennessee, United States
General information
Forum:
Microsoft SQL Server
Category:
Backups
Miscellaneous
Thread ID:
00826365
Message ID:
00826684
Views:
25
This message has been marked as the solution to the initial question of the thread.
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--
Previous
Reply
Map
View

Click here to load this message in the networking platform