View Single Post
  #1 (permalink)  
Old September 23rd, 2005, 12:56 PM
pipelineconsulting pipelineconsulting is offline
Registered User
 
Join Date: Sep 2005
Location: Leicester, , United Kingdom.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Rename a Column using SQL

I have an Access database and wish to change the name of a table column from within an ASP.NET application.

I would prefer to use an SQL statment and an OleDbCommand to do this and then ExecuteNonQuery() etc.

Two possible SQL statements are:

Code:
ALTER TABLE tablename RENAME COLUMN OldName TO NewName
or
Code:
ALTER TABLE tablename RENAME OldName TO NewName
Neither of these statements work and I get an SQL Syntax Error.

Does anyone know what the correct SQL statment is? I can add and remove columns OK using similar SQL statements, just can't rename a column/field!

Cheers

Graham Wilson

Reply With Quote