If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Syntax error rename column sql

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-17-10, 06:52
Tiggerandpoo Tiggerandpoo is offline
Registered User
 
Join Date: Mar 2009
Posts: 36
Syntax error rename column sql

Hi

I am trying to rename a column in my table and I keep on getting a syntax error message. This is very annoying since I have been sitting on this problem for ages now and I just cannot see what I am doing wrong!!!!!

DoCmd****nSQL ("ALTER table tbl_holding RENAME COLUMN [Work Location#Work Location - Country] TO 'Work Location - Country';")


Please help!
Reply With Quote
  #2 (permalink)  
Old 11-17-10, 07:00
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
My first response is that is not valid SQL. You got a source?
__________________
Testimonial:
Quote:
pootle flump
ur codings are working excelent.
Reply With Quote
  #3 (permalink)  
Old 11-17-10, 07:03
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
Ok, checked and it is not valid.
Intermediate Microsoft Jet SQL for Access 2000

You need to create the new one and drop the old one. If you have data in the table you need to update the new column before dropping the old one.

Since you are changing names, I would recommend using alphanumerics only, and optionally underscore. No spaces or dashes.
__________________
Testimonial:
Quote:
pootle flump
ur codings are working excelent.
Reply With Quote
  #4 (permalink)  
Old 11-17-10, 07:10
Tiggerandpoo Tiggerandpoo is offline
Registered User
 
Join Date: Mar 2009
Posts: 36
Hi

Thanks for the reply. Do you mind posting the link again. I could not access the last copy.

s
Reply With Quote
  #5 (permalink)  
Old 11-17-10, 07:53
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
I think there is an error with MSDN. I have had trouble with other MS sites today. Google for "Jet Intermediate SQL". Use the Cached version. There are also Basic and Advanced SQL documents. They are excellent.

It might seem rather obvious now, but fabricating your own syntax and then spending a day "debugging" it is not going to get yourself anywhere very fast. I know the syntax looks sensible enough but it's not any use if the application doesn't recognise it.

Anyway, you know the docs to refer to now for JET DDL.
__________________
Testimonial:
Quote:
pootle flump
ur codings are working excelent.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On