We have a index field setup in an existing Application Group as "string" and we need to change it to "Decimal". Is there a way to do this in OnDemand?
Thanks
Russell
Nope, as far as I know, DB2 doesn't support that, so CMOD can't make it happen. You've got to build a new App Group, and then combine the data from both at the Folder level.
You could do an export/import with arsdoc and arsload, but that may take a long time, and be unnecessarily complex if you have a lot of data.
-JD.
Or what you can do, is add a new field in your existing application group, and then do an update on the segment table to fill the new field from string to decimal.
Then on the folder, you change the string field with a decimal field (meaning basically to recreate a new folder...)
On the application side, you put a default value on the old string field with a dummy value "."
So you don't need to recreate a new application group.
Unofficially, there is a non supported way :-) but that requires a lot of DB2 manipulation... lots of changes in the ARS tables too... and I don't know if it is worth mentioning it!!
If you have some DBA, and some time to kill... and some nerves then to do it in the production... then it can be done.... (I've done it to convert a column from string to integer, and also the reverse integer to string).
But I won't advise it...
Thanks Justin and Alessandro.
Alessandro,
You mentioned updating the segment table to fill the new field form the string to decimal. Is there an update command that I can run, or would this have to be done by the DBA?
Thanks,
Russell
Hi Russell,
Well it can be done either from a DBA or from you. Depending on who has the right to perform such operation.
for DB2 a command like that could do the trick:
$ db2 "update SEG set newField=double(oldField)"
for each SEG table of your AG.
Of course, it means that every string in each row is correctly structured, if something is not "correct" maybe you will need to correct everything, and run or rerun several times this command.
Alex
Thanks.