Jump to content


Photo

alter table rename field


  • Please log in to reply
No replies to this topic

#1 mackenzie_hart

mackenzie_hart
  • Members
  • Pip
  • Newbie
  • 1 posts
  • Locationfinland

Posted 16 November 2005 - 08:06 PM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users