Can You Import Only PART Of A Database, Without Losing Keys and Constraints

  • I'm trying to import tables from one database into another database which is a structurally-identical copy of the first; but I only want to import a handful of the tables. When I do this, the Keys and Constraints don't come across- Is there a way to make it so they do?

    Thanks!

    d

  • Script your tables first through SSMS right click databases, all tasks generate scripts, you get more options than just generating scripts from the table. make sure you set the "script indexes" etc to true.

    Get the script, run it on the server your creating tables on.

    Then do a quick import/export task to copy over the data

  • Another option is to download a trial version of SQL Compare (www.red-gate.com) and SQL Data Compare.

    Build a comparison project between your two databases using SQL Compare, select only those objects you want synchronized and run the synchronization. Now you can you SQL Data Compare to synchronize the data between the objects.

    Works very well and definitely worth the money for the tools.

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

  • jeff.williams3188 (2/3/2008)


    Another option is to download a trial version of SQL Compare (www.red-gate.com) and SQL Data Compare.

    Build a comparison project between your two databases using SQL Compare, select only those objects you want synchronized and run the synchronization. Now you can you SQL Data Compare to synchronize the data between the objects.

    Works very well and definitely worth the money for the tools.

    Completely agree - an excellent piece of software that saved us days and days when releasing new builds of software. None of the devs made notes of what tables/SPs they changed so as part of the release we compared the current prod db against the dev one and just used the script.

  • John Morris (2/3/2008)


    jeff.williams3188 (2/3/2008)


    Another option is to download a trial version of SQL Compare (www.red-gate.com) and SQL Data Compare.

    Build a comparison project between your two databases using SQL Compare, select only those objects you want synchronized and run the synchronization. Now you can you SQL Data Compare to synchronize the data between the objects.

    Works very well and definitely worth the money for the tools.

    Completely agree - an excellent piece of software that saved us days and days when releasing new builds of software. None of the devs made notes of what tables/SPs they changed so as part of the release we compared the current prod db against the dev one and just used the script.

    I generally use the tools to validate my DEV, QA and Live systems (among others). These systems are vendor supplied and I have caught them several times making changes to our live system without testing or validating the changes in our DEV and QA systems.

    Remarkable how easy it is to make sure your vendor follows change management procedures when you send them a report showing the differences in live that should not be there.

    Another great tool to use is Beyond Compare (www.scootersoftware.com). This is a file comparison tool that I use to validate the application code on our web servers (five web server farm), not to mention being able to find differences between DEV, QA and live web servers also.

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

  • A quick note -

    Red Gates tools are for comparing differences between databases, SQL Compare for structure, SQL Data Compare for Data.

    Beyond Compare for comparing files in a file system, no DB capabilities.

    Not to say that either is bad/good but both serve different functions. I happen to use/own both - best $ I've spent in either regard.

    Joe

  • Yes, SQL compare is powerful and very useful tool, and easily move the changes from testing to production environment. and also we can take snapshot of database before moving changes to production. if any issues comes you can always get back the old script by comparing the snapshot and live database.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply