Dark Knight Dark Knight - 1 month ago 9
ASP.NET (C#) Question

How to copy the server database to my local Machine to generate scripts

My boss said
"To do so, SCRIPT the real database using SQL Manager / Tasks
RUN that script locally in a Query Window on your own machine to create a local copy of the database.

Note: Your new database will have all Tables and Procedures but will have NO data in it. You will need to add your own "dummy data" to make things work for you as you test.

Create a second connection string in your

web.config
that connects to your local database
use that connection string for your development work

However i don't actually understand how to do that.

Answer

Follow these steps:

1. Connect to your remote server from SQL Server Management Studio.
2. In object explorer, right click on your database and select Tasks>Generate Scripts.
3. Click on Next and then again click on Next.
4. Select the file system path where you want to save the database script for the database and click on Next
5. Click on Next. A .sql file will generated.
6. Connect to your local server from SQL Server Management Studio.
7. Open the newly created database script in SQL Server Management Studio and execute it. A copy of your database on remote server will
be created on your local server.
Comments