By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,007 Members | 1,248 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,007 IT Pros & Developers. It's quick & easy.

generated column

P: n/a
Hi

Can I convert a plain integer column (non-key) in a table to a generated
column using the ALTER TABLE .. ALTER COLUMN statement?

If not, should I use the ALTOBJ statement?

-R-
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Jurgen Haan wrote:
Hi

Can I convert a plain integer column (non-key) in a table to a generated
column using the ALTER TABLE .. ALTER COLUMN statement?

If not, should I use the ALTOBJ statement?

-R-

Direct mit ALTER TABLE. Neu in V8.2

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #2

P: n/a
Serge Rielau wrote:
Jurgen Haan wrote:
Hi

Can I convert a plain integer column (non-key) in a table to a
generated column using the ALTER TABLE .. ALTER COLUMN statement?

If not, should I use the ALTOBJ statement?

-R-


Direct mit ALTER TABLE. Neu in V8.2


Ah. Vielen dank.

I'm not German though (dutch) :P
(I DO understand the language)

-R-
Nov 12 '05 #3

P: n/a
Okay... I've defined a small test setup:
Created the following table
test (
bla1 integer,
bla2 integer,
);

inserted the following values: ((0,0),(0,1),(1,0),(1,1))

then I used the following statements:

set integrity for test off;
alter table test alter column BLA2 set generated always as (BLA1+2);
set integrity for test immediate checked force generated;

resulting in:

BLA1 BLA2
----------- -----------
0 2
0 2
1 3
1 3

Works like a charm :)

-R-
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.