Friday, December 14, 2007

How to delete a column in a table?

How to delete a column in a table?

We can use the "Execute" method in the ADO connection to delete a column in the table:

<%

Set conn = Server.CreateObject("Adodb.Connection")

conn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("db1.mdb")

conn.execute "ALTER TABLE master DROP COLUMN name"

'ALTER TABLE master - Select the table

'DROP COLUMN name - Select the column that you want to delete.

%>

No comments: