OVH Cloud OVH Cloud

urgent: ALTER TABLE!

2 réponses
Avatar
Carmen
I have a table "Corres". "no_control" is a column
autonumeric type and the primary key with an index
named "IndexP". "Corres.no_control" is a foreing Key into
the tables "Copia" and "Destinatario". I have two
constraints:
"Corers1" = Destinatario.no_control to Corres.no_control
(update cascade, delete cascade)
"corres2" = Copia.no_control to Corres.no_control (update
cascade, delete cascade)
I have to made a macro that clean the table corres and
restore the "no_control" to 1.

I have this steps:
1. Delete * from corres
2. alter table destinatario drop constraint corres1
3. alter table copia drop constraint corres2
4. ALTER TABLE CORRES DROP constraint [IndexP]
5. ALTER TABLE CORRES DROP [no_control]
6. ALTER TABLE Corres ADD no_control Numeric,Constraint
PrimaryKey Primary Key (no_control)
7. ALTER TABLE Destinatario ADD CONSTRAINT corres1
FOREIGN KEY (no_control) REFERENCES Corres (no_control)
[oN DELETE CASCADE ON UPDATE CASCADE]
8. ALTER TABLE Copia ADD CONSTRAINT corres2 FOREIGN KEY
(no_control) REFERENCES Corres (no_control) [oN DELETE
CASCADE ON UPDATE CASCADE]

the problem is:
In the step 6 I have to create the column no_control with
autonumeric type not Numeric but I do not know the reserve
word.
In the step 7 and 8 the part [oN DELETE CASCADE ON UPDATE
CASCADE] don't work.

Est-ce quequ'un pourrait m'aider s'il vous plait???
Merci en avance
Carmen

2 réponses

Avatar
3stone
"Carmen"
| I have a table "Corres". "no_control" is a column
<snip>
| Est-ce quequ'un pourrait m'aider s'il vous plait???

Si tu ne prends pas les enfants du bon dieu pour des...

;-)))

--
A+
Pierre (3stone) Access MVP
-------------------------------------------------------
Bien démarrer ? c'est ici http://users.skynet.be/mpfa/
( Je ne réponds pas aux emails qui concernent Access )
-------------------------------------------------------
Avatar
Carmen
Vraiment je n'ai pas compris ce message a cause de mon
mauvais français, mais je peux imaginer bien sur
l'intention, de tout façon j'ai trouvé une solution pour
mon problem que je te laisse meme si tu n'as pas été tres
comprensive.

http://msdn.microsoft.com/library/en-
us/dnacc2k/html/acintsql.asp?frame=true

Bon journée!



-----Message d'origine-----
"Carmen"
| I have a table "Corres". "no_control" is a column
<snip>
| Est-ce quequ'un pourrait m'aider s'il vous plait???

Si tu ne prends pas les enfants du bon dieu pour des...

;-)))

--
A+
Pierre (3stone) Access MVP
-------------------------------------------------------
Bien démarrer ? c'est ici http://users.skynet.be/mpfa/
( Je ne réponds pas aux emails qui concernent Access )
-------------------------------------------------------




.