0

I kind of new to SQL Server, I always used access db for my sites.

I created a SQL Server on my local computer and now I want to take this db and transfer it to the server. In access all I had to do is, take the mdb file and put it on the server and change the connection string. How can I transfer the SQL Server db to the server?

Is there any file to put on the server ?

Also the connection string isn't a folder but a local computer like this:

Data Source=my-PC;Initial Catalog=storeSQL1;User ID='my-PC\com';Password='';Trusted_Connection=YES;

Who can provide me this connection string for the server (the hosting company) ?

1
  • You can generate scripts with Management studio and run that on server database to create your db. You can add user and create password and use connection string similar to what you mentioned above Commented Dec 22, 2011 at 15:14

5 Answers 5

1

The easiest way would probably be to create a backup of the database on your local machine, then restore that backup on the new server.

Sign up to request clarification or add additional context in comments.

1 Comment

+1 - In many cases this is the simplest and least time consuming
1

Roadmap is:

  1. Do simple backup-restore to move user databases to target server.
  2. Create script on source server, that can recover permissions and login-users pairing
  3. Restore the CLR and TRUSTWORTHY security for databases, that using unsafe assemblies, simpliest way is (in proper DB):

    exec sp_changedbowner 'sa' --sa just for example
    
    ALTER DATABASE dbname SET TRUSTWORTHY ON
    
  4. Enjoy

Comments

0

Depending on your version of SQL Server here is a good article that outlines all the ways to move a SQL Server Database.

http://blogs.msdn.com/b/sreekarm/archive/2009/09/11/move-a-database-from-one-server-to-another-server-in-sql-server-2008.aspx

As for getting the connection string yes the hosting company would provide you with that. Where is the database hosted, you could check their knowledge base articles or if it's an in house data base I'm sure a dba could provide you with that information. It won't change much from what you have but it will change.

Comments

0

I'm not sure what tools your using, but to start you need to do a dump or backup of your current database on your machine. After you do that then you can do and import which should create all the tables and import any data you have.

After the data exists on the server then as far as the connection string, you just need to say the Data Source is the server ip address or host name and change your User ID and Pass to match that server.

If you need more details on any part of this process, post what tools your using and what your environment looks like and I would be more than happy to assist you.

Comments

0

In my opinion the best way to do that is to detach the db from one server(pc), copy the files to the second one and then attach them on the second server/pc.

To detach:

USE master;
GO
EXEC sp_detach_db @dbname = N'AdventureWorks2008R2';
GO

To attach:

USE master;
GO
CREATE DATABASE MyAdventureWorks 
    ON (FILENAME = 'C:\MySQLServer\AdventureWorks2008R2_Data.mdf'),
    (FILENAME = 'C:\MySQLServer\AdventureWorks2008R2_Log.ldf')
    FOR ATTACH;
GO

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.