Copy Local Database (mdf) to a server

I'm starting to learn MVC and so far is doing well. By default MVC provides to create a database for handling
user Identity details but it is saved locally. I would like to copy the structure of the database from local to a server. I do not know where the location of the database (Local DB).
To the MVC and SQL experts, my advance thanks.
zachvaldezAsked:
Who is Participating?
 
Pawan KumarDatabase ExpertCommented:
Sorry somehow i missed this.
You take your mdf file to your server and run below command in SSMS.
CREATE DATABASE yourDBName ON
( FILENAME = N'C:\Program Files\Microsoft SQL Server\YourSQLServerVersion\MSSQL\DATA\yourfile.mdf')
FOR ATTACH
GO
1
 
Pawan KumarDatabase ExpertCommented:
Go to the SSMS.
Connect to your LocalDB.
Take backup of your DB->then take the .bak file on the server and restore it on the server. This method will create the localDB on the server.

or you can use the generate scripts to get the create SQLs and then take that on the server and run.
0
 
zachvaldezAuthor Commented:
This is interesting. How would I know the name of my 'LocalDB'. Is it 'LocalDB' per se ? or some real name?
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Pawan KumarDatabase ExpertCommented:
Go to SSMS.
Put .(dot) in the server name.
it will connect to you local sql server.
Then check for your DB name.
0
 
zachvaldezAuthor Commented:
Ok, I found the mdf file in my project but it is save locally. I would like to get a copy of this mdf file to a server or even to my
local server. Can you provide the steps?
BTW, putting "'." in the server name didn't work. I don't know the reasoning behind that either.
0
 
zachvaldezAuthor Commented:
Any more interest in this question?
0
 
zachvaldezAuthor Commented:
Sure!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.