You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Rick Hillegas <Ri...@Sun.COM> on 2007/09/07 15:48:35 UTC

Re: how to remove a column

Hi Brandon,

This syntax works in the latest Derby release (10.3.1.4). Are you using 
an older version of Derby?

Thanks,
-Rick

Brandon Dohman wrote:
> I was wondering what the sql syntax is to drop a column from a derby 
> database.
>
> i tried this and it gave me the error below: ALTER TABLE contacts DROP 
> COLUMN userid
>
> Error code -1, SQL state 42X01: Syntax error: Encountered "DROP" at 
> line 1, column 22.
> Line 1, column 1
>
> Thanks for your help
>
>


Re: how to remove a column

Posted by Peter Ondruska <pe...@gmail.com>.
Create another table without the column you want to drop and insert  
data from old table.

On 7.9.2007, at 18:07, Brandon Dohman wrote:

> Is it possible to remove a column any other way?  Without using the  
> drop command?
>
> Tim Dudgeon wrote:
>> 10.3 is the first released version to support DROP COLUMN.
>> Prior to 10.3 this was not possible.
>>
>> Tim
>>
>> Brandon Dohman wrote:
>>> Rick
>>>
>>> Yes I am using the older version, not sure which version, but I  
>>> haven't updated it since January of this year.  Due to time  
>>> constraints i would prefer not to update at this time.  Unless it  
>>> can't be avoided to drop a column that I need dropped.
>>>
>>> Thanks for your help
>>>
>>> Rick Hillegas wrote:
>>>> Hi Brandon,
>>>>
>>>> This syntax works in the latest Derby release (10.3.1.4). Are  
>>>> you using an older version of Derby?
>>>>
>>>> Thanks,
>>>> -Rick
>>>>
>>>> Brandon Dohman wrote:
>>>>> I was wondering what the sql syntax is to drop a column from a  
>>>>> derby database.
>>>>>
>>>>> i tried this and it gave me the error below: ALTER TABLE  
>>>>> contacts DROP COLUMN userid
>>>>>
>>>>> Error code -1, SQL state 42X01: Syntax error: Encountered  
>>>>> "DROP" at line 1, column 22.
>>>>> Line 1, column 1
>>>>>
>>>>> Thanks for your help
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
> -- 
>
> Brandon Dohman
> Chief Technical Officer
> Mobile Medical Systems
> 2612 DeWitt Av
> Mattoon, IL 61938
> 815.383.6909
>
> www.mobilemedicalsystems.com
> www.pen.eiu.edu/~brdohman
>


Re: how to remove a column

Posted by Mark Thornton <mt...@optrak.co.uk>.
Brandon Dohman wrote:
> Is it possible to remove a column any other way?  Without using the 
> drop command?
>
>
Create a new table with the correct columns but a different name, copy 
content of the old table to the new one (except for the unwanted 
column). Drop any foreign key constraints referencing the old table. 
drop the old table. Rename the new table to the old name. Add back 
constraints if required.

I guess this wasn't what you wanted to know.

Mark Thornton

Re: how to remove a column

Posted by Rick Hillegas <Ri...@Sun.COM>.
Hi Brandon,

This is described in the Derby Developer's Guide, 
http://db.apache.org/derby/docs/10.3/devguide/ The left pane is a table 
of contents--near the top you will see a link for the section on Upgrade.

Hope this helps,
-Rick

Brandon Dohman wrote:
> what is the process for upgrading from one db version to another.  i looked over the guides but didn't see anything for it, potentially i missed it.
>
> Thanks for all the help on this topic.
>
> ----- Original Message -----
> From: Tim Dudgeon <td...@informaticsmatters.com>
> To: derby-user@db.apache.org
> Sent: Fri, 7 Sep 2007 10:34:34 -0500 (CDT)
> Subject: Re: how to remove a column
>
> Brandon Dohman wrote:
>   
>> Is it possible to remove a column any other way?  Without using the drop 
>> command?
>>
>>     
>
> I solved this by building a patched version of the 10.2 releases that 
> included the drop column capability form 10.3 back ported.
>
> I can provide you with that derby.jar if that helps.
>
> But I would suggest that planning to use 10.3 is a better approach.
>
>
> Tim
>
>
>   


Re: how to remove a column

Posted by Brandon Dohman <br...@eiu.edu>.
what is the process for upgrading from one db version to another.  i looked over the guides but didn't see anything for it, potentially i missed it.

Thanks for all the help on this topic.

----- Original Message -----
From: Tim Dudgeon <td...@informaticsmatters.com>
To: derby-user@db.apache.org
Sent: Fri, 7 Sep 2007 10:34:34 -0500 (CDT)
Subject: Re: how to remove a column

Brandon Dohman wrote:
> Is it possible to remove a column any other way?  Without using the drop 
> command?
> 

I solved this by building a patched version of the 10.2 releases that 
included the drop column capability form 10.3 back ported.

I can provide you with that derby.jar if that helps.

But I would suggest that planning to use 10.3 is a better approach.


Tim



Re: how to remove a column

Posted by Tim Dudgeon <td...@informaticsmatters.com>.
Brandon Dohman wrote:
> Is it possible to remove a column any other way?  Without using the drop 
> command?
> 

I solved this by building a patched version of the 10.2 releases that 
included the drop column capability form 10.3 back ported.

I can provide you with that derby.jar if that helps.

But I would suggest that planning to use 10.3 is a better approach.


Tim


Re: how to remove a column

Posted by Brandon Dohman <br...@eiu.edu>.
Is it possible to remove a column any other way?  Without using the drop 
command?

Tim Dudgeon wrote:
> 10.3 is the first released version to support DROP COLUMN.
> Prior to 10.3 this was not possible.
>
> Tim
>
> Brandon Dohman wrote:
>> Rick
>>
>> Yes I am using the older version, not sure which version, but I 
>> haven't updated it since January of this year.  Due to time 
>> constraints i would prefer not to update at this time.  Unless it 
>> can't be avoided to drop a column that I need dropped.
>>
>> Thanks for your help
>>
>> Rick Hillegas wrote:
>>> Hi Brandon,
>>>
>>> This syntax works in the latest Derby release (10.3.1.4). Are you 
>>> using an older version of Derby?
>>>
>>> Thanks,
>>> -Rick
>>>
>>> Brandon Dohman wrote:
>>>> I was wondering what the sql syntax is to drop a column from a 
>>>> derby database.
>>>>
>>>> i tried this and it gave me the error below: ALTER TABLE contacts 
>>>> DROP COLUMN userid
>>>>
>>>> Error code -1, SQL state 42X01: Syntax error: Encountered "DROP" at 
>>>> line 1, column 22.
>>>> Line 1, column 1
>>>>
>>>> Thanks for your help
>>>>
>>>>
>>>
>>>
>>
>>
>
>

-- 

Brandon Dohman
Chief Technical Officer
Mobile Medical Systems
2612 DeWitt Av
Mattoon, IL 61938
815.383.6909

www.mobilemedicalsystems.com
www.pen.eiu.edu/~brdohman


Re: how to remove a column

Posted by Tim Dudgeon <td...@informaticsmatters.com>.
10.3 is the first released version to support DROP COLUMN.
Prior to 10.3 this was not possible.

Tim

Brandon Dohman wrote:
> Rick
> 
> Yes I am using the older version, not sure which version, but I haven't 
> updated it since January of this year.  Due to time constraints i would 
> prefer not to update at this time.  Unless it can't be avoided to drop a 
> column that I need dropped.
> 
> Thanks for your help
> 
> Rick Hillegas wrote:
>> Hi Brandon,
>>
>> This syntax works in the latest Derby release (10.3.1.4). Are you 
>> using an older version of Derby?
>>
>> Thanks,
>> -Rick
>>
>> Brandon Dohman wrote:
>>> I was wondering what the sql syntax is to drop a column from a derby 
>>> database.
>>>
>>> i tried this and it gave me the error below: ALTER TABLE contacts 
>>> DROP COLUMN userid
>>>
>>> Error code -1, SQL state 42X01: Syntax error: Encountered "DROP" at 
>>> line 1, column 22.
>>> Line 1, column 1
>>>
>>> Thanks for your help
>>>
>>>
>>
>>
> 
> 


Re: how to remove a column

Posted by Brandon Dohman <br...@eiu.edu>.
Rick

Yes I am using the older version, not sure which version, but I haven't 
updated it since January of this year.  Due to time constraints i would 
prefer not to update at this time.  Unless it can't be avoided to drop a 
column that I need dropped.

Thanks for your help

Rick Hillegas wrote:
> Hi Brandon,
>
> This syntax works in the latest Derby release (10.3.1.4). Are you 
> using an older version of Derby?
>
> Thanks,
> -Rick
>
> Brandon Dohman wrote:
>> I was wondering what the sql syntax is to drop a column from a derby 
>> database.
>>
>> i tried this and it gave me the error below: ALTER TABLE contacts 
>> DROP COLUMN userid
>>
>> Error code -1, SQL state 42X01: Syntax error: Encountered "DROP" at 
>> line 1, column 22.
>> Line 1, column 1
>>
>> Thanks for your help
>>
>>
>
>