0

I created a database using Microsoft SQL Sever Management Studio Express but I could not find it on my computer. I could not search it by name as well. I need to copy it to App_data of my application, but how?

2
  • can you still see it and open it from Management Studio Express? Commented Sep 3, 2011 at 12:50
  • Did you perform a search for files named *.mdf? Commented Sep 3, 2011 at 12:50

4 Answers 4

3

if you can still see the database in SQL Management studio and want to see where the data and log files are, simply execute this command:

USE <database_name>
GO
sp_helpfile
GO
Sign up to request clarification or add additional context in comments.

4 Comments

I guess he doesn't even know the name of the db :)
then he does not deserve to be using SQL Server :D how can he connect to a db with a connection string without knowing its name?
mine was just a guess, don't know exactly. My guess, he will recognize the db when he sees it :) the problem is where the heck is the db?
Yeah, I figured that. but if you not use GO as you do on the 2nd line, we have to use exec :)
0

Browse to below folder :

%ProgramFiles%\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA

was it there?

NOTE:

This is the default folder for MS SQL Server Express database files (mdf and ldf files) and it might not be the same for you if you changed it or create your db inside another folder or disk.

UPDATE

run the following script :

USE [master]
SELECT * FROM sys.databases

Is it there?

Comments

0

I would start with

select name, create_date from sys.databases order by create_date desc;

to get the names of the databases on that server. Than proceed with Davide Piras answer

USE <database_name>;

exec sp_helpfile;

Comments

0

Run this to get all the fils and the databases that you have on your catalog:

Use master
GO

SELECT 
name AS [LogicalName]
,physical_name AS [Location]
,state_desc AS [Status]
FROM sys.master_files

if you see it then the catalog have it all you have to do is to restart the service

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.