|
| Change a field name that is a reserved word |
 |
Wed, 27 Feb 2008 20:47:48 -050 |
I am converting an Interbase 5.6 database that contains column names that
are reserved words in IB2007. It was backed up in IB5.6 and restored into
IB2007 with no problem. If I use IBConsole and manually alter the column
name and save, it works. But I need to automate this process, so I am trying
to use
ALTER TABLE mytable ALTER colname TO newname
But because it is a reserved word, it doesn't like the command. (One of the
column names in question is "type"). I have tried several things but
can't
seem to get it to work.
Is there a way to get Interbase to accept this, at least enough to allow me
to change the name to something that isn't a reserved word?
|
| Post Reply
|
| Re: Change a field name that is a reserved word |
 |
Wed, 27 Feb 2008 21:38:59 -050 |
Scott Leake wrote:
> I am converting an Interbase 5.6 database that contains column names that
> are reserved words in IB2007. It was backed up in IB5.6 and restored into
> IB2007 with no problem. If I use IBConsole and manually alter the column
> name and save, it works. But I need to automate this process, so I am
trying
> to use
>
> ALTER TABLE mytable ALTER colname TO newname
>
> But because it is a reserved word, it doesn't like the command. (One of
the
> column names in question is "type"). I have tried several things
but can't
> seem to get it to work.
>
> Is there a way to get Interbase to accept this, at least enough to allow
me
> to change the name to something that isn't a reserved word?
>
You need to double quote the reserved words. Remember this makes it case
sensitive so make sure the column is all caps.
--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
And so I patrol in the valley of the shadow of the tricolor
I must fear evil. For I am but mortal and mortals can only die.
Asking questions, pleading answers from the nameless
faceless watchers that stalk the carpeted corridors of Whitehall.
|
| Post Reply
|
| Re: Change a field name that is a reserved word |
 |
28 Feb 2008 17:41:18 -0700 |
Do you get the same error in isql?
--
|
| Post Reply
|
| Re: Change a field name that is a reserved word |
 |
Thu, 28 Feb 2008 18:45:44 -050 |
On 2/27/08 9:38 PM, in article 47c61ec2$1@newsgroups.borland.com, "Jeff
Overcash (TeamB)" <jeffovercash@mindspring.com> wrote:
> You need to double quote the reserved words. Remember this makes it case
> sensitive so make sure the column is all caps.
The two columns I am dealing with are PERCENT and TYPE. In IBConsole, using
Interactive SQL, I put in this statement:
ALTER TABLE footage ALTER "PERCENT" TO pct;
I get back:
SQL error code = -104
Token unknown - line 1, char 26
"PERCENT"
There is definitely a column named PERCENT.
Any thoughts?
Scott
|
| Post Reply
|
| Re: Change a field name that is a reserved word |
 |
Fri, 29 Feb 2008 10:14:19 +010 |
> > You need to double quote the reserved words. Remember this makes it
case
> > sensitive so make sure the column is all caps.
>
> The two columns I am dealing with are PERCENT and TYPE. In IBConsole,
using
> Interactive SQL, I put in this statement:
>
> ALTER TABLE footage ALTER "PERCENT" TO pct;
>
> I get back:
>
> SQL error code = -104
> Token unknown - line 1, char 26
> "PERCENT"
>
> There is definitely a column named PERCENT.
>
> Any thoughts?
What is the connection dialect?
I think you need to use dialect 3 to use delimited identifiers.
--
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com
|
| Post Reply
|
|
|
|
|
|
|
|
|
|