|
| Part | Description |
|---|---|
| table | The name of the table to be altered. |
| field | The name of the field to be added to or deleted from table. Or, the name of the field to be altered in table. |
| type | The data type of field. |
| size | The field size in characters (Text and Binary fields only). |
| index | The index for field. |
| multifieldindex | The definition of a multiple-field index to be added to table. |
| indexname | The name of the multiple-field index to be removed. |
From the above information you can see that the Alter Table statement has three common forms:
Alter Table Statement:
ADD COLUMN
ALTER COLUMN
DROP COLUMN
Here we add a foreign key constraint to the M_employees table for Dept_ID in the L_Departments table:
ALTER TABLE M_Employees ADD CONSTRAINT fk_Employee_Dept FOREIGN KEY (Dept_ID) REFERENCES L_Departments (Dept_ID);
Next we drop the constraint that we just added:
ALTER TABLE M_Employees DROP CONSTRAINT fk_Employee_Dept;
To send patches to customer you might want to send a little database that scripts the changes using Visual Basic code:
Sub
Create_Table_Script()
Dim db As Database
Set db = OpenDatabase("yourcustomers.mdb")
'alter employees table to add foreign key reference as above
db.Execute "ALTER TABLE M_Employees ADD CONSTRAINT
fk_Employee_Dept FOREIGN KEY (Dept_ID) REFERENCES L_Departments
(Dept_ID);"
db.Close
End Sub
|
Contact Information
|