![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
While attempting to use DTS, to import an ASCII text file, comma delimited, I get this error. violation of primary key constraint I checked the file, it is perfect. The problem was, we had to restore a database to an earlier date, due to problems, we later found were caused by a user. After restoring, they starting adding information into it. The OLD database, the one we thought was grunged, and unfixable, was backed up to a test server. After making sure everything was OK, we used DTS to export the information contained in it, that was needed to bring the database in use, up to date. Why me???? It just won't work. Currently running SQL 7, SP2. |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
Close. The text file with information came from using a copy of the SAME database, but contains information that is NOT in the database that is in use. The main problem is, I know close to nothing about SQL. 1. We had a database that "APPEARED" to be corrupt. We backed it up, and restored it to an SQL test bed. 2. We restored a copy of the database, from 4 days previous. 3. I used DTS on the Test Server, to export the missing 4 days of data 4. I cannot import it into the operational database, because of the primary key constraint error. 5. I am now considering weapons of mass destruction. Thanks.. <G ******************************** Not sure if I understand but You have a text file of information You have a table that needs to receive the information You try and it vio;ates the PK constraint. How'm I doing ? I would 1. Grab the definition of the PK from the table 2. Check the for duplicates. If as you say this is clean then it has to be in the table 3. Import the file into a staging area (exact match of the real table)(BTW this is what I always do with a text file) 4. Now using TSQL do a comparison on Key columns using an INNER join between the two tables. 5 The records you get back are the violations |
![]() |
| Thread Tools | |
| Display Modes | |
| |