PDA

View Full Version : Use of an identity field



JasonToyne
01-03-2006, 06:07 AM
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

MattCasters
01-03-2006, 06:15 AM
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

jirajara2
03-01-2009, 01:18 PM
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

MattCasters
03-02-2009, 04:25 AM
Dan, it's been 3 years already.

Leaving the ID out works fine for MySQL 5.1.

DebbieKat
03-03-2009, 12:25 PM
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: