Export/Import

  • Hello,

    Can anybody help me out for my problem in import data to a set of table having primary and foreign key constraints?

    Scenario:

    I have tables with some data in it ,those are old data.With out deleting the old data i have to import new data into this table from a similar structured database also some similar data.When i run import it stops due to this unique key constraint.Is there any way to ignore all the constraints and perform the append action in the table.

  • The constraints are there to protect your data, don't disable or remove them to get the data in. What you need to do is either import the data into a staging table and then amend it with unique keys so that you can then import it into the real table or create something like an SSIS package to do it for you. What are the unique/pk fields based on? Are they sequential numbers or coded?

  • Hello,

    The database is a well structured one with 88 tables and perfect constraint relationships.Most of the Primary keys are numeric columns.So whether i have to create 88 staging tables for doing an import .

    Regards

    Susan

  • If you have primary key then you will have unique key constraint .

    So check the data that you are import to the column having PK constraint has no values that are repeating.

    Tanx 😀

  • ,10Yes i have same data in all table for example.The old database have table 1 with primary key values as 1,2,3,4

    New database table 1 with primary key values as 1,2,3,4,5,6,7,8,9,10

    So i want to keep in a database table 1 both old data and new data.

    Or atleast i should be able to find out what is differencr between two table..

    That means the query should return 5,6,7,8,9,10.

    Regards

    susan

  • First thing ,

    Make sure on primary key column there should not be any duplicates from the column you are mapping.

    Secondary,

    When you import for the child tables check that amount of data on parent tables.

    What i suggest is make import in two different sections one for Primary and another for child/foreign key constraints issue will also resolves.

  • Import wont allow dulpicates in the primary key column

    Regards

    Susan

  • If have to keep both the table data in the same database its better to create table1_New.

    to query both table1 and table1_new use join table with where clause.

    You cannot add duplicate values if have PK constraints.

    Tanx 😀

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

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