Change Attribute type from integer to decimal - error on publish

Change Attribute type from integer to decimal - error on publish

We have an entity attribute whose Data Type is Integer & would like to change it to Decimal.

When we change the "
Data Type" of this attribute from Integer to Decimal & publish, we get an error message stating "Publishing Error -Unable to upgrade database schema.Could not change the '<EntityName.AttributeName>' attribute from 'Integer' to ' Decimal', since existing records could not be converted to 'Decimal'.
 Could you please suggest the appropriate procedure to make this convertion.

Do let me know if any part of the question isn't clear

Thanks !!

bit strange, because every integer should be converted to decimal without any problem.

safest way:
- create a new column decimal
- publish it on all platforms
- copy all values in new column
- delete integer column
- publish it on all platforms
Hi Naimisha,

If you do not have access to the database directly, all you can do is add a new attribute to the entity of type Decimal, and write a bootstrap to copy over the values. Then delete the old attribute, and fix your code. If you really want to keep the same attribute name, you can repeat this after deleting the old column.

If you do have direct access to the database, delete the integer attribute, add a new attribute with the same name of type decimal, and bootstrap it via a database script with the proper conversion. Note that although the new attribute will be named the same, the database column will be called something like Attribute1 if the old column was named Attribute.
Damn, ninjaed by J. Anyway, J., this is not strange, at least SQL server doesn't see, to like these kind of conversions on columns, though I've never tried to convert it by an ALTER TABLE directly.
@kilian yes it is strange, since integers are a subset of decimals. it should be possible to convert it wihout any problems afaik.
there is a bunch of straightforward alters which should be doable without any issues :)