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 se开发者_开发百科arch it by name as well. I need to copy it to App_data of my application, but how?
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
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?
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;
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
精彩评论