Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

where is the default location for all databases in sql server

Tags:

sql-server

I'm trying to find the default location for all my local databases using sql server. Does anyone know?

like image 664
locoboy Avatar asked Mar 30 '11 18:03

locoboy


4 Answers

Info here.

For you it should be \Program Files\Microsoft SQL Server\MSSQL.90\MSSQL\Data\

like image 88
JNK Avatar answered Sep 30 '22 15:09

JNK


try this exec dbo.sp_helpdb <db_name>;

if all you need is the files, use short one as use <db_name> exec sys.sp_helpfile;

like image 45
Kris Ivanov Avatar answered Sep 30 '22 16:09

Kris Ivanov


For SQL Server 2005 / 2008 it should be somewhere like C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA.

Search C:\Program Files\Microsoft SQL Server for .mdf files.

like image 26
Amasuriel Avatar answered Sep 30 '22 15:09

Amasuriel


do you mean the location of the .mdf and .ldf files? for sql server 2008 on my machine those default to:

C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA

like image 42
eoldre Avatar answered Sep 30 '22 16:09

eoldre