importing and exporting constraints

  • i'm trying to export the tables and views in a database to another and i'm using ms sql server 2005 enterprise but the problem is that the wizard will import the tables and all its contents but the primary keys, the foreign keys and all other constraints wouldn't be imported with the table schema and contents.by the way i'm using the import export wizard found in the sql server 2005 enterprise

    please if u have any idea don't be shy to share with us.

    thanks in advance for the effort...

  • Best way to do this is use Data modeling tool like ERwin.

    Alternate is creat Script for the same.

    ---------------------------------------------------
    "Thare are only 10 types of people in the world:
    Those who understand binary, and those who don't."

  • I would script the constraints then apply the script.

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
  • Dear All,

    How to script the constraints?

    Thx

    Thanks

  • How the data willl come in tables in other DB,if we only script and create the tables in other DB.

    Thx

    Thanks

  • guptaajay1985 (2/10/2009)


    How the data willl come in tables in other DB,if we only script and create the tables in other DB.Thx

    It doesn't. You have to move the data.

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
  • guptaajay1985 (2/10/2009)


    How to script the constraints?

    Have you scripted your tables?

    Look closely, constraints are there.

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
  • Hallo,

    I have the same problem.

    I want to backup one table with all dependent objects, before one script will for example alter the table. This should happen dynamically through a job scheduling system.

    I haven't the possibility to manually create a create script with the SQL Server Management Studio.

    The table and its contents is no problem, but the dependent objects.

    Until now, nobody could tell me a solution for this.

    I would be very happy, if someone knew what to do.

    AE

  • bisso21 (2/10/2009)


    i'm trying to export the tables and views in a database to another and i'm using ms sql server 2005 enterprise but the problem is that the wizard will import the tables and all its contents but the primary keys, the foreign keys and all other constraints wouldn't be imported with the table schema and contents.by the way i'm using the import export wizard found in the sql server 2005 enterprise

    please if u have any idea don't be shy to share with us.

    thanks in advance for the effort...

    I assume you're exporting tables to a database that doesn't already contain them. The wizard does not create constraints and indexes by default. You can work around that by clicking the "Edit Mappings..." button after selecting the source and destination. You'll see that "Create destination table" is selected. Click the "Edit SQL..." button and modify the CREATE statement to include the constraints. When executed, the wizard will create the table then copy the data.

    Greg

Viewing 9 posts - 1 through 8 (of 8 total)

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