Column-Populate
Posted in 2005
Topics: Migration, Import/Export & Data Conversion
Hi, I have a table of approximately 15 million rows. I would like to create a new column and use SQL to populate it with a unique number based on a grouping of three other columns already with data existing in them (flds 1-3). For example: <new> fld1 fld2 fld3 0001 333 01/01/2004 8746 0001 333 01/01/2004 8746 0001 333 01/01/2004 8746 0002 355 01/02/2004 8888 0002 355 01/02/2004 8888 Can this be done using an update or do I need to populate the column using an unload process? Thank you, Tony
Unload or process it using a host language program in ESQL/C, 4GL, C-CLI, Java, Perl-DBI/DBD, etc. I would do the latter. BTW the combination of the three columns is not unique nor will the new column be, and I understand it's just a shorter key to single out similar records based on those three columns, but, my question is: Does this table have a truly UNIQUE key field? It should, otherwise how would you select one of the multiple alike records for update or deletion? Art S. Kagel ----- Original Message ----- From: Tony Demeis <Tony.Demeis@moh.gov.on.ca> At: 3/31 9:49 > Hi, > > I have a table of approximately 15 million rows. I would like to create a > new column and use SQL to populate it with a unique number based on a > grouping of three other columns already with data existing in them (flds > 1-3). > > For example: > <new> fld1 fld2 fld3 > 0001 333 01/01/2004 8746 > 0001 333 01/01/2004 8746 > 0001 333 01/01/2004 8746 > 0002 355 01/02/2004 8888 > 0002 355 01/02/2004 8888 > > Can this be done using an update or do I need to populate the column using > an unload process? > > > > Thank you, > Tony