What I need to do is to save the id column for future use and then
modify the id column resetting all values from another sequence.
So I need to select the id column or somehow get the data into another
column in the same table.
And then I can update the id column (after dropping the constraint).
J.V.
On 10/4/2011 1:09 PM, Scott Marlowe wrote:
> On Tue, Oct 4, 2011 at 12:24 PM, J.V.<jvsrvcs@gmail.com> wrote:
>> Currently I can select one column into another with two statements:
>>
>> alter table<table_name> add column id_old int;
>> update<table_name> set id_old = id;
>>
>> Is there a way to do this in one statement with a select into? I have tried
>> various select statements but want the new column (with the same data) to be
>> in the same table and to have it execute much more quickly that the two
>> statements currently do.
> Do you need another column or do you just want to alter a column that
> already exists? If so you can alter a column from one type to another
> and throw a using clause at it to convert the data in some way. I
> think we need to know a bit better what you're trying to do.,
>