Microsoft Dynamics CRM 4 - How to change a custom attribute's datatype

Yesterday I was trying to import a customization from one CRM 4 environment to another. There I faced an issue with same attribute being duplicated in both environments with two different data types. Due to a still unknown technical issue we can not delete any attributes from these environments. So the only option for me was to change the data type of the attribute in one environment to equal the both the data types. As the CRM 4 does not allow to change custom attribute types from the interface I had to do this from the back end (database).

Below is the query I use to do this;

UPDATE attribute
SET
attributetypeid = GUID of the data type
WHERE name = attributename

You can find the data type guid's from attributetypes table.

PS : You will also have to change the datatype of the perticular column in the perticular table manually.
 
Blog Directory - OnToplist.com