Can I change a Persistence type of a DateTime field after it has been saved?

Version 6

    Generally the answer to this is no, after you have saved the Attribute you cannot go back and change the Persistence type on this.

     

    However this can be done by running a script towards the DataBase.


    Please note that you need to configure the below script to suit the attribute that you wish to change. You need to change the zzzzzz in the script below to the NAME of the business object and the xxxxxx in the script below to the NAME of the attribute you want to change the persistance type on.

     

    Also note that this should ONLY ever be done on an attribute that is a DATETIME attribute

    For Group Attribute see here:

    http://community.landesk.com/support/docs/DOC-27185

    For User Attribute see here:

    http://community.landesk.com/support/docs/DOC-27184

    If you run this script towards an attribute that is NOT a datetime attribute then you WILL corrupt your attribute and maybe even your DataBase.

     

    Please make sure that you take a fully restorable backup of your database before running this and that you also try on a test system first.

     

     

    This is for changing into a "CreateDateTime" Persistence:

    -------------------------------------------------
    update md_attribute_type set md_persistence_flags='4', md_is_readonly='1'
    where md_class_type_guid=(select md_guid from md_class_type where md_name='zzzzzz' )
    and md_name='xxxxxx'

    -------------------------------------------------

     

     

    This is for changing into a "UpdateDateTime" Persistence:

    -------------------------------------------------
    update md_attribute_type set md_persistence_flags='128', md_is_readonly='1'
    where md_class_type_guid=(select md_guid from md_class_type where md_name='zzzzzz' )
    and md_name='xxxxxx'

    -------------------------------------------------

     

     

    This is for changing into a "UpdateDateTime AND "CreateDateTime" Persistence:

    -------------------------------------------------
    update md_attribute_type set md_persistence_flags='132', md_is_readonly='1'
    where md_class_type_guid=(select md_guid from md_class_type where md_name='zzzzzz' )
    and md_name='xxxxxx'

    -------------------------------------------------

     

     

    This is for removing the Persistence Type:

    -------------------------------------------------
    update md_attribute_type set md_persistence_flags='0', md_is_readonly='0'
    where md_class_type_guid=(select md_guid from md_class_type where md_name='zzzzzz' )
    and md_name='xxxxxx'

    -------------------------------------------------