Furqan Sehgal
Furqan Sehgal

Reputation: 4997

Can not find SQL database created using SQL Sever Management Studio Express

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?

Upvotes: 0

Views: 812

Answers (4)

ARAZI
ARAZI

Reputation: 126

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

Upvotes: 0

bernd_k
bernd_k

Reputation: 11966

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;

Upvotes: 0

tugberk
tugberk

Reputation: 58444

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?

Upvotes: 0

Davide Piras
Davide Piras

Reputation: 44605

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

Upvotes: 3

Related Questions