29.05.2008, 17:05 | #1 |
Участник
|
axStart: table & field ID conflicts
Источник: http://axstart.spaces.live.com/Blog/...C0A0!343.entry
============== <div> table & field ID conflicts. Some months ago, I posted an article about SQLDictionary ID conflicts. It was a x++ job that scans and solves at once. Last month I have to do this in a use live environment. The customer preferred detailed information about the ID conflicts and solving it was the next step. The keyword in this process is: Don’t lose customer data on the Database! Let’s look at next example Tablename AOT ID SQL ID A 50003 40001 B 40025 40013 C 40026 40025 So I created a script that checks:
From the results I created small jobs that solved the ID conflicts on a structural way.
{ SQLDIctionary dictionary; void doTable(int aotTable, int sqlTable) { ttsbegin; while select forupdate dictionary where dictionary.tabId == sqlTable { dictionary.tabId = aotTable; dictionary.update(); } ttscommit; } ; ttsbegin; doTable( tablenum(a), 40001 ) ; doTable( tablenum(c), 40031 ) ; doTable( tablenum(b), 40025 ) ; ttscommit; }
{ SQLDIctionary dictionary; void doField(int aotTtable, int aotField, int sqlField) { ttsbegin; while select forupdate dictionary where dictionary.tabId == aotTtable && dictionary.fieldId == sqlField { dictionary.fieldId = aotField; dictionary.update(); } ttscommit; } ; ttsbegin; dofield(tablenum(A),fieldnum( A,field),4001); dofield(tablenum(B),fieldnum( B,otherfield),4002); ttscommit; } For analyzing the ID conflicts I used this script, It can also be used for checking if the ID conflicts are solved. static void checkSQLDictionary(Args _args) { SQLDictionary dictionary,dictionaryMissing; str tableName; int AOTTableID, AOTFieldID; TreeNodetreeNode; boolean doTable; boolean skip; sysdictFieldsdf; SysDictTablesdt; str propertyName; int sdtFields,sdtFieldsTotal; ; <font color="#000000"><font face=Arial><font size=1> while select dictionary order by tabid,fieldId where dictionary.fieldId
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|