AccessDiscussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
I am in the process of writing a utility that will allow for database modifications via SQL. One of the issues I am up against is how to rename a field inside of a table using SQL. This needs to be done because I have to set an index on a field named 'Year' and since this is a key word with Access, the sql statement is giving me fits. I have to rename the field, set the index then rename it back. Everything is done except for the renaming of the field.
more importantly - I am looking for the proper format of a query that can be used to rename the field of a table. I believe it will be an 'Alter' or 'Update' query. Either way, I am sure that a 'Select' query will not do much for me.
I am in the process of writing a utility that will allow for database modifications via SQL. One of the issues I am up against is how to rename a field inside of a table using SQL. This needs to be done because I have to set an index on a field named 'Year' and since this is a key word with Access, the sql statement is giving me fits. I have to rename the field, set the index then rename it back. Everything is done except for the renaming of the field.
to rename
for eg chenge column name for fnmae to fname in table employee
step 1 rename employee to employe
step 2 create table employee (fname,lname , and other columns of table) as select * from employe.
then drop employe
and add constraints againn to employee if any exist.
alter table do not change name of column , table and size of column if table data exist
I am in the process of writing a utility that will allow for database modifications via SQL. One of the issues I am up against is how to rename a field inside of a table using SQL. This needs to be done because I have to set an index on a field named 'Year' and since this is a key word with Access, the sql statement is giving me fits. I have to rename the field, set the index then rename it back. Everything is done except for the renaming of the field.
to rename
for eg chenge column name for fnmae to fname in table employee
step 1 rename employee to employe
step 2 create table employee (fname,lname , and other columns of table) as select * from employe.
then drop employe
and add constraints againn to employee if any exist.
alter table do not change name of column , table and size of column if table data exist