AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 29.05.2008, 17:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,640 / 848 (80) +++++++
Регистрация: 28.10.2006
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:
  • Difference in Table ID
  • Difference in Field ID
  • Difference in String size
    Changed field properties
Check if documents in document management are attached to tables with an ID conflict. (or amy other table).
From the results I created small jobs that solved the ID conflicts on a structural way.
  • Solve any difference in the field Properties In your AOT (string size, Created date, etc)
    Solve the Table ID conflicts Process the tables in an order that the change to a non existing ID in the sqldicttable. So we have to solve first table C next table B. We will not fix the Field ID issues yet.
static void repairSQLDictTableConflicts(Args _args)
{
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;
}
 
  • Solve the Field ID conflicts. I used the next job for solving the Field ID conflicts
static void repairSQLDictFieldConflicts(Args _args)
{
  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, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
axStart: Check if the table field is mapped. Blog bot DAX Blogs 0 07.03.2009 00:05
axStart: How to convert a column in a table to a different type with the same name without losing data. Blog bot DAX Blogs 0 01.02.2008 21:21
axStart: Best practice for creating/changing sales/purchase & project reports. Blog bot DAX Blogs 0 23.12.2007 17:51
SysDictCoder: Table browser with field groups Blog bot DAX Blogs 6 09.08.2007 09:56
Dynamics AX: SQL Tuning: Table & Index Scans Blog bot DAX Blogs 0 20.07.2007 11:50

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 14:22.