# Database Discussions > Microsoft SQL Server 2008 >  How to copy ms sql file to a server.

## earlcools

How to copy ms sql file to a server.
I create a MS SQL database.  Using Visual Studio I created a Web Site using the data. 
I want to update the data so I was able to important to my local machine. 
I made a copy of the local database (hrd.mbf) with the idea to just paste it on the server to replaces (hrd.mbf) on the server.
*On the server*
I put hrd.mbf offline when renamed it (hrd1.mbf)
I copied hrd.mbf.
In the SQL Server object Explorer it showed hrd (suspect) it added the word suspect next to the table.
I use Visual Studio to create a login page so only some employees can see the data. When I go to page it asks to login, which is what it is supposed to do when I to login I get an error message saying that it cannot connect to the hrd.
Does anyone know the correct way to do this?

----------


## rmiao

Are you talking about sql server db or Access db? They are completely different.

----------


## earlcools

> Are you talking about sql server db or Access db? They are completely different.


Sql server

----------


## rmiao

Sql server doesn't use .mbf by default. Anyway, better to do backup/restore for sql db instead of file copy. Have to copy log file too if you still want to copy files.

----------


## earlcools

> Sql server doesn't use .mbf by default. Anyway, better to do backup/restore for sql db instead of file copy. Have to copy log file too if you still want to copy files.


Thanks so far

I have the database on the network I used the backUP
when I try to access it with the browser I get an error message.

Cannot open database "DatabaseName" requested by the login. The login failed.
Login failed for user 'Databaseuserdb'.

----------


## earlcools

> Thanks so far
> 
> I have the database on the network I used the backUP
> when I try to access it with the browser I get an error message.
> 
> Cannot open database "DatabaseName" requested by the login. The login failed.
> Login failed for user 'Databaseuserdb'.



I am not sure if that would be the problem the local machine database had windows authentication
When I made the backup. The one on the network uses SQL Authentication.

----------


## rmiao

Just add sql login as user of the db and grant proper permissions.

----------


## earlcools

> Just add sql login as user of the db and grant proper permissions.


I have tried not sure what I am doing wrong.

<add name="DefaultConnection" connectionString="Data Source=10.5.41.19;Initial Catalog=aspnet-cxcDB-20130627224632.mdf;User ID=sa;Password=P@Dalia3636" providerName="System.Data.SqlClient" />
    <add name="CXCDBConnectionString1" connectionString="Data Source=10.5.41.19;Initial Catalog=CXCDB;User ID=sa;Password=P@Dalia3636" providerName="System.Data.SqlClient" />

thanks for help

----------


## rmiao

You have to grant sql permission in sql server not in connection string, do you have dba in your company by the way?

----------


## earlcools

> You have to grant sql permission in sql server not in connection string, do you have dba in your company by the way?


I 

I am the one in charge of the database and the site so i guess i am the dba (if that's ok with you) :Big Grin:

----------


## rmiao

That's fine with me but looks like you need basic dba training.

----------


## earlcools

> That's fine with me but looks like you need basic dba training.


this is my first application.

I appreciate the love shown.

thanks for trying to help me.

----------

