0

I have to transfer the data and structure of a SQL Server database to an already created empty database.

I have 4 tables with auto-increment keys, where 3 tables are sub tables of the master. The database also has the ASP.NET membership tables, which I need to copy across as has user data.

Any ideas, I have tried usually SQL Server 2012 Management Studio, but won't keep the auto inc keys and ASP.NET membership tables.

5
  • 1
    you can take backup of DB and restore on empty DB. Follow msdn.microsoft.com/en-us/library/ms187510.aspx and msdn.microsoft.com/en-us/library/ms177429.aspx Commented Jan 11, 2015 at 20:30
  • It wont let me do it as its via a website panel, and i cannot use the same db name. maybe iam doing it wrong.? Commented Jan 11, 2015 at 20:35
  • 1
    Then make your question Clear, what and where you want? and let us know what you tried till now, what problem you getting Commented Jan 11, 2015 at 20:36
  • Ok. bit more info. I have successfully created a backup of the database in question using sql management studio to my local drive folder. On the destination server i dont have the option to name the db as the same name. Due to the providers auto naming prefix which it attaches. When i try and restore the db to this newly created db, i use vs man studio, select the file location of the backup in the device option and choose the new database database in the destination folder. The verify backup media works ok but the restore fails. I can restore it to its original name. Any ideas Commented Jan 11, 2015 at 21:48
  • Ok. changed the filename and overite option and now working. Commented Jan 11, 2015 at 21:54

1 Answer 1

1

You have two simple options

  1. backup and Restore database on the target server.

  2. But since you have mentioned you want to copy the data and schema from one database to another empty(existing) database, I would suggest SQL Server Scripting would be a better option for you. You can scripts sql-server objects and data (just data or just schema) and execute these scripts on the target database.

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

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.