Generated Column

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jal
    New Member
    • Aug 2007
    • 10

    #1

    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.sysdummy 1),
    C2 CHARACTER (10) NOT NULL )
    IN TS03_16K_OES INDEX IN IX03_4K_OES ;

    Any help would be appreciated.
  • Rahul B
    New Member
    • Jun 2007
    • 11

    #2
    Don't you have to do current_date instead of current date?

    Originally posted by Jal
    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.sysdummy 1),
    C2 CHARACTER (10) NOT NULL )
    IN TS03_16K_OES INDEX IN IX03_4K_OES ;

    Any help would be appreciated.

    Comment

    Working...