Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: Use of an identity field

  1. #1
    Join Date
    Dec 2005
    Posts
    3

    Default Use of an identity field

    Hi,


    I have a table output with an identity field. How do I handle the identity field so that it is not removed from the table?



    I have tried defining the identity field as a null value constant but that doesn't work. If I don't define the identity field the table ouput tries to alter the table and remove the column.



    Thanks,



    Jason Toyne

  2. #2
    Join Date
    Nov 1999
    Posts
    9,729

    Default RE: Use of an identity field

    Jason,

    Unfortunately this is not completely database independend.
    For most databases just avoid sending the field value to the database. A NULL value won't do.
    However, in certain rare case (for example Informix) you need to send a 'placeholder', for example integer 0.

    In your case, probably just removing the value with a SelectValues step will do the trick (second tab)

    Hope this helps.

    Matt

  3. #3
    Join Date
    Nov 2008
    Posts
    1

    Default

    Hello, there's probably a better solution but what i did was.

    First I have to let you know that I'm using MySQL 5.1 as my DB Engine

    I couldn't use thee select values as matt suggested because i had the select values step before de table output step, ergo it didn't find a ID field on the the metadata... So

    I used a previous Modified JavaScript Valued step to determine the month, so I created another var which I called ID (ID is the name of my identity field) and assigned 0 to it "var ID = 0" and when I run the transformation MySQL apparentlly ignores it and assigns the correct value according to the table information...

    Hope this helps after to years hahaha

    If someone knows a better solution I will appreciate it

    Dan

  4. #4
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    Dan, it's been 3 years already.

    Leaving the ID out works fine for MySQL 5.1.

  5. #5
    Join Date
    Feb 2008
    Posts
    216

    Default Works fine in SQLServer as well

    Quote Originally Posted by MattCasters View Post
    Dan, it's been 3 years already.

    Leaving the ID out works fine for MySQL 5.1.
    I leave it blank but I add the column to the table output step in the return auto-generated key area:
    Attached Images Attached Images  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.