Jump to content

alter table rename field


mackenzie_hart

Recommended Posts

hey everyone, sorry to post this question here, this is a general sql stuff, but couldnt post it to php sql forum. anyway, heres the problem: i try to rename field in a table, like this:

 

$query="ALTER TABLE table1 RENAME field1 TO field2";

 

and that wont work, dont understand where is the problem. other ALTER TABLE stuff works good. but with this i keep get this error message:

 

Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access -driver] Syntax Error in ALTER TABLE., SQL state 37000 in SQLExecDirect in C:\server\test.php on line 7

 

heres the whole code im using:

$conn=odbc_connect('filename','','');

$query="ALTER TABLE table1 RENAME field1 TO field2";

odbc_exec($conn,$query);

odbc_close($conn);

 

thanks. mackenzie

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.