467,189 Members | 1,305 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,189 developers. It's quick & easy.

Generated Column

I want a generated column which will have the current date as well as a running number concatenated yyyymmddxxxxxx
where xxxxxx is a running sequence.

Can I use a SQL query to generate the sequence No? I tried the follwing, but even something as simple as this doesnt work. It doesnt take Current date in the expression.

CREATE TABLE JS.TEST (
C1 INTEGER NOT NULL GENERATED ALWAYS AS (select month(current date) from sysibm.sysdummy1),
C2 CHARACTER (10) NOT NULL )
IN TS03_16K_OES INDEX IN IX03_4K_OES ;

Any help would be appreciated.
Aug 16 '07 #1
  • viewed: 1447
Share:
1 Reply
Don't you have to do current_date instead of current date?

I want a generated column which will have the current date as well as a running number concatenated yyyymmddxxxxxx
where xxxxxx is a running sequence.

Can I use a SQL query to generate the sequence No? I tried the follwing, but even something as simple as this doesnt work. It doesnt take Current date in the expression.

CREATE TABLE JS.TEST (
C1 INTEGER NOT NULL GENERATED ALWAYS AS (select month(current date) from sysibm.sysdummy1),
C2 CHARACTER (10) NOT NULL )
IN TS03_16K_OES INDEX IN IX03_4K_OES ;

Any help would be appreciated.
Aug 18 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by db2group88@yahoo.com | last post: by
1 post views Thread by Robert Stearns | last post: by
3 posts views Thread by Jessard | last post: by
1 post views Thread by Frank Swarbrick | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.