I've got problem while sql querying Cm database.
Should datetimeinserted field of device table return timestamp of when phone profile has been created?
I'm getting just empty string, while values of other fields in this table returned successfully.
that's correct, datetimeinserted field shows the time when device inserted.
See the information below the field name in CUCM SQL Dictionary https://developer.cisco.com/media/UCM10.5DataDictionary/UCM10.5DataDictionary.htm#device
I have already performed some tests with sql query on cucm 10.5 and 8.6.
Like you, I get NULL in datetimeinserted but maybe Cisco just give us the option to change this value over insert/update SQL queries.
I performed SQL update on device specific and the field changed
run sql update device set datetimeinserted="131101" where pkid='f514f548-9bc4-3dd7-0cef-1222c3996d4c'
pkid name datetimeinserted
=============================== ===================== ==============
f514f548-9bc4-3dd7-0cef-1222c3996d4c AXL 7861 Phone Template 131101
It's possible (maybe even likely?) that the datetimeinserted field was defined at some point in the DB historically but never actually used by the CUCM code implementation, or its function was removed...if it's not getting written, then the assumption is somewhat necessarily that this is by design.
To some extent, apps dealing with accessing the raw SQL data must face the sometimes unexplained quirks of the system...I.e. engineering would likely not contemplate a bug report or enhancement request to start populating this field purely for 3rd party app convenience...
Unfortunately, I'm not aware of another way of getting such timestamp info. About the only suggestion would be to consider the 'Change Notification' system, whereby the app could become aware of CRUD operations on DB items (like devices) in semi-real-time, and assign its own internal time-stamp...