0

I have a database with data, I want to copy the all tables with data to newly created database also with same existed auto incremented primary field. How I can do that process.

  • 1
    Any reason you can't do a backup and restore? – MrTCS Mar 29 '17 at 15:25
2

There are a couple of ways to do this. It depends on your setup. As per the previous question, if you just need a copy of everything you can backup and restore the database onto a new instance or, on the same instance with a different name.

If you need to physically pipe data with identity columns, into a new database thats already setup, you could use the import export tool. With that you can easily select just the tables you want data from, and the destination. Its quick and easy for a one time load. If you need to keep Identity columns, remember to select Column Mappings, and check the box to enable Identity insert per the article on Microsoft's website.

This is just one option to moving the data. A quick google and you will find many other options, including BCP, Linked Servers, SSIS, etc. It all depends on how often you want to do this load. How often do you need to do this?

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.