0

i want to export data and schema from live Database to my local database, i tried "export data" option while right clicking on live db but it only exports data but not constraints on columns. kindly help me out?

1
  • is "Generate script" work ? Commented Feb 10, 2016 at 11:09

1 Answer 1

2

Try this:

  1. Open SQL Server Management Studio.
  2. Choose the database and click with right button.
  3. Tasks > Generate Scripts...
  4. Next.
  5. Select the objects (tables, etc) or select the entire database and click next.
  6. Click Advanced button and select what do you want. There is an option "Types of data to script", select "Schema and data".
  7. Next

If the database is big you will need to execute the script using the prompt in your local database.

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

3 Comments

all is good except shows error in "USE [master] CREATE DATABASE [leadattendant] ON PRIMARY ( NAME = N'leadattendant', FILENAME = N'c:\Program Files (x86)\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\leadattendant.mdf' , SIZE = 2048KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB"
What is the message error? Are you logged as "sa" user? I suggest you create manually your local database, with user and schema, and generate the script only for Tables, Views, Stored Procedures and User-Defined Functions.
Don't forget to choose the "Schema and data" option in the Advanced button.

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.