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

Generated Column

P: 10
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
Share this Question
Share on Google+
1 Reply


P: 11
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.