Source language: Translate to:

Syntax problems - renaming fields?

Questions about our Advanced Database plug-in

Moderator: Neosoft Support

Syntax problems - renaming fields?

Postby markofapproval » Fri Jul 04, 2008 6:45 am

I am new to databases and I am having trouble with the syntax. I foolishly named a field "Region ID#" but short of deleting the whole table and reimporting back in the items, what command do I use to rename the field?

All the SQL scripts I have tried have failed. Maybe it's because I created it in Neobook with the only option of using an AccessDatabase. What I want to do is not have connectivity to a server but rather an embedded database. I was using the free database version but unfortunately, it isn't relational. I need to querie multipe tables for my project.

If anybody could help me with the syntax for renaming the field Region ID# in the table Region to something simpler I would be greatful. My 30days of trial of the prodatabase is about to expire as I installed it but didn't look at it till now :( so before I buy I need to know if it suits my needs.
markofapproval
 
Posts: 5
Joined: Sat Jun 28, 2008 12:13 am

Postby Gaev » Fri Jul 04, 2008 8:16 am

markofapproval:

The syntax for changing the name of a field is ...
Code: Select all
ALTER yourTableName CHANGE currentFieldName newFieldName

... but you have a "space" in your currentFieldName ... i.e. "Region ID#" ... which would confuse the SQL command parser.

After you backup your database, you might try ...
Code: Select all
ALTER yourTableName CHANGE 'Region ID#' yourNewFieldName
... substituting appropriate values for yourTableName and yourNewFieldName.

short of deleting the whole table and reimporting back in the items, what command do I use to rename the field?

How many records in your database Table ? ... with just a few lines of code you should be able to get NeoBookDBPro to do most of the heavy lifting.
User avatar
Gaev
 
Posts: 3737
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby markofapproval » Fri Jul 04, 2008 3:22 pm

Hi Gaev,

Thank you for your response. Unfortunately, this command didn't work but I think the reason is that I am using an access table (as automatically generated by neobook). After a bit of research, I found there is no code to change the name. Instead the user is expected to do it through access's interface. Perhaps this is Microsoft's way of making sure people have access which I don't :roll:

Anyway, I just deleted the table after exporting the data and reimported it back no worries. Thanks again for your help. It is much appreciated.

Mark.
markofapproval
 
Posts: 5
Joined: Sat Jun 28, 2008 12:13 am


Return to NeoBookDBPro

Who is online

Users browsing this forum: No registered users and 2 guests

cron