Link to home
Start Free TrialLog in
Avatar of Bahnass
BahnassFlag for Egypt

asked on

NEEDED ACCESS Statment like ALTER TABLE ttt RENAME COLUMN aaa TO bbb

A very important task

I Need  to rename an access database field from VB dot net 2005

I forgot all about using DAO
if possible SQL statement
like


ALTER TABLE ttt RENAME COLUMN aaa TO bbb
that works in SQL

Avatar of VoteyDisciple
VoteyDisciple

I don't remember Access-specific DDL queries too well, but I'd guess it's:

ALTER TABLE ttt CHANGE COLUMN aaa bbb INT NOT NULL;
Avatar of Bahnass

ASKER

thx dear but

CHANGE is not a reserved word in ACCESS SQL

you need to add a reference to the ADO Extensions for Security and Data Definition (ADOX)

then you can use the ADOX.Catalog and ADOX.Table objects

AW

Avatar of Bahnass

ASKER

Don't know how to do for vb 2005
Avatar of Bahnass

ASKER

Sorry I repated it
on
https://www.experts-exchange.com/questions/22078122/RENAME-ACCESS-DB-FIELD-BY-SQL-Statment.html
and had the answer

I believe the only way you can accomplish this is by:

1)  Adding a column:

ALTER TABLE yourTableName ADD COLUMN NewName datatype(size)

2)  Run an update statement to copy the data from the old column to the new one:

UPDATE yourTableName SET NewName = OldName

3)  Then drop the old column:

ALTER TABLE yourTableName DROP COLUMN OldName
ASKER CERTIFIED SOLUTION
Avatar of maralans
maralans

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bahnass

ASKER

Dear maralans
Just wanted to say thank U with these 500 point