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?
4 Answers
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
4 Comments
tugberk
I guess he doesn't even know the name of the db :)
Davide Piras
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?
tugberk
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?
tugberk
Yeah, I figured that. but if you not use GO as you do on the 2nd line, we have to use exec :)
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?
*.mdf?