473,406 Members | 2,387 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

[Q] Pb with IDENTITY pointer after LOAD

Bonjour,

J'ai un problème avec une colonne type IDENTITY; pouvez certainement
m'aider.

J'ai 2 tables identiques dans des environnements différents avec une
colonne IDENTITY
de type numéro sequentiel.
ENV1-TABLE : 1025 records --> IDENTITY colonne pointe sur 1026 pour
prochain INSERT
ENV2-TABLE : 1041 records --> IDENTITY colonne pointe sur 1042 pour
prochain INSERT

Dans ces 2 tables, les 1000 premiers records sont identiques et c'est
dans les 2
environnements qu'elles ont évoluées differemment.

Le problème c'est que je dois recharger ENV1-TABLE à partir des
données de ENV2-TABLE et
cela sans recréer ENV1-TABLE et que la table et rechargée on a :

ENV1-TABLE : 1041 records --> IDENTITY colonne pointe sur 1026 pour
prochain INSERT

la colonne IDENTITY ne pointe plus sur la bonne valeur puisqu'elle n'a
pas changer et qu'au
prochain INSERT je récupère un DUPLICATE KEY.
J'ai envisagé :

Recharger la table ENV1-TABLE rien qu'avec des INSERT : long
Recharger la table ENV1-TABLE jusque 1025 puis INSERT de 1026 à 1041 :
long + bidouille
Recharger la table ENV1-TABLE par LOAD + INSERT bidon à la fin :
bidouille

Voyez-vous d'autres solution

Merci Hervé
Nov 12 '05 #1
2 2422
Ian
Herv? Bonnard wrote:
Bonjour,

J'ai un problème avec une colonne type IDENTITY; pouvez certainement
m'aider.

J'ai 2 tables identiques dans des environnements différents avec une
colonne IDENTITY
de type numéro sequentiel.
ENV1-TABLE : 1025 records --> IDENTITY colonne pointe sur 1026 pour
prochain INSERT
ENV2-TABLE : 1041 records --> IDENTITY colonne pointe sur 1042 pour
prochain INSERT

Dans ces 2 tables, les 1000 premiers records sont identiques et c'est
dans les 2
environnements qu'elles ont évoluées differemment.

Le problème c'est que je dois recharger ENV1-TABLE à partir des
données de ENV2-TABLE et
cela sans recréer ENV1-TABLE et que la table et rechargée on a :

ENV1-TABLE : 1041 records --> IDENTITY colonne pointe sur 1026 pour
prochain INSERT

la colonne IDENTITY ne pointe plus sur la bonne valeur puisqu'elle n'a
pas changer et qu'au
prochain INSERT je récupère un DUPLICATE KEY.


My french is rusty, but if I understand you correctly:

After you've loaded the table in ENV1, you need to update the identity
column to start with a new number. You can do this with SQL:

alter table TAB alter column IDENTITY_COL restart with 1042
After this point, you won't receive unique key violations.
Good luck,

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 12 '05 #2
Ian, Serge

Merci


he***********@wanadoo.fr (Herv? Bonnard) wrote in message news:<c9**************************@posting.google. com>...
Bonjour,

J'ai un problème avec une colonne type IDENTITY; pouvez certainement
m'aider.

J'ai 2 tables identiques dans des environnements différents avec une
colonne IDENTITY
de type numéro sequentiel.
ENV1-TABLE : 1025 records --> IDENTITY colonne pointe sur 1026 pour
prochain INSERT
ENV2-TABLE : 1041 records --> IDENTITY colonne pointe sur 1042 pour
prochain INSERT

Dans ces 2 tables, les 1000 premiers records sont identiques et c'est
dans les 2
environnements qu'elles ont évoluées differemment.

Le problème c'est que je dois recharger ENV1-TABLE à partir des
données de ENV2-TABLE et
cela sans recréer ENV1-TABLE et que la table et rechargée on a :

ENV1-TABLE : 1041 records --> IDENTITY colonne pointe sur 1026 pour
prochain INSERT

la colonne IDENTITY ne pointe plus sur la bonne valeur puisqu'elle n'a
pas changer et qu'au
prochain INSERT je récupère un DUPLICATE KEY.
J'ai envisagé :

Recharger la table ENV1-TABLE rien qu'avec des INSERT : long
Recharger la table ENV1-TABLE jusque 1025 puis INSERT de 1026 à 1041 :
long + bidouille
Recharger la table ENV1-TABLE par LOAD + INSERT bidon à la fin :
bidouille

Voyez-vous d'autres solution

Merci Hervé

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Devesh Aggarwal | last post by:
Hi, I have a backup and restore module in my project. The backup uses a typed dataset object (XSD) to get the data from database and creates a xml file as the backup file (using the WriteXml...
3
by: Srini | last post by:
Hello, I would like to know Identity OR sequence which is better?. My requirement is simple. I have a parent table with ID (generated or from sequence) and I want that ID after inserting...
2
by: valerio | last post by:
Hi all, I've some problem to import data to DB2 using the db2move and db2look tools. Follow the problem : I have exported data from db2 v. 7 database on windows server, using the db2look and...
7
by: Praveen_db2 | last post by:
Hi all Db2 8.1.3 Windows I have to load a table with an identity column with GENERATED ALWAYS option. I have to load the data in the identity column as it is. I created the table and tried...
3
by: nicolas.bouchard | last post by:
I am developing an integration process between two databases. One of them is a SQL Server 2000 and the other is using MSDE 2000. The integration process is done in C# (VS2003). The main database...
3
by: Sumanth | last post by:
Hi, We are having a strange problem that appears on Fix Pack 10. Problem: When using bulkloader to load data into a table that has a identity column, the records get rejected and are not...
3
by: Rob | last post by:
Hi all, I have a bit of a complicated question, hope we have an SQL guru out there that can help us solve this killer problem. Due to the size of SQL Database we have (largest in the US), we...
1
by: Pydimarri Srinivas | last post by:
Hi All, I am trying to purge the data from a DB2 table having identity column defined usind DB2 utilitties. I am getting the following error "DSNU269I .............Field is invalid" "The...
11
by: stegze | last post by:
Hi All, I have a problem with a DB2 server of my customer. It is a Debian Linux running DB2 Express-C. I have an IDENTITY field as PK in a table and I use this value as FK in another table. Two...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.