|
Columns Management |
|
|
Column Deletion |
|
As opposed to creating a new column, if you have a column that has become useless on a table, you can get rid of it. To delete a column, use the DROP COLUMN expression followed by the name of the column. Before deleting a column, make sure it exists on the table. Here is an example: Private Sub cmdAlterTable_Click()
Dim conEmployees As ADODB.Connection
Dim strSQL As String
Set conEmployees = New ADODB.Connection
conEmployees.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source='C:\Programs\MSVB\ADO2\MVA1.mdb'"
strSQL = "ALTER TABLE Employees DROP COLUMN Notes;"
conEmployees.Execute strSQL
MsgBox "The Notes column of the Employees table has been removed"
Set conEmployees = Nothing
End Sub
|
|
|
|
|
Column Modification |
|
If a certain aspect of a column is wrong while its name fine, you can modify the column without deleting and recreating it. To modify an aspect of the column, use the ALTER COLUMN, followed by the name of the column, and the modification to perform. For example, to change the data type and optionally the length of data, on the right side of the column name, enter the data type and the option. |
|
|
|
|
|
||
| Previous | Copyright © 2001-2005 FunctionX, Inc. | Next |
|
|
||