Friday 8 June 2012

Some issues during changing index uniqueness


Some times we need to create a new unique index or alter existing one, but table may already contain duplicate data for this index and our changes could not be applied until data in table fixed to support uniqueness. We could do it by deleting records in the table but due to huge number of companies in environment it could be time consuming. To save your time you could use following job:
static void Job3(Args _args)
{
    MyTable myTable;
    DataArea da;
    int cnt;
    ;
    ttsbegin;
    while select da
    {
        cnt = 1;
        changecompany(da.Id)
        {
            myTable = null;
            while select forupdate myTable
            {
                cnt++;
                myTable.FieldForUniqueness = int2str( cnt );
                myTable.update();
            }
        }
    }
    ttscommit;
}
Another way to solve this problem is to make following steps:
  1. Try to synchronize your table
  2. You get an error saying that there are duplicates
  3. Rright away you go to Administration > Periodic > SQL Administration form.
  4. Select your table in the list and run Table actions > Check/Synchronize command.
  5. In appeared form enable “Check Allow duplicated’” and run.
  6. You will get a list of conflicting records to kill.

Copied from Experts website....... Dynamicsaxtraining.
You can always reach me at axapta4all@gmail.com
Anonymous Axaptian   

3 comments:

  1. Đôi mắt là cửa sổ của tâm hồn , chính vì vậy nên việc giữ cho đôi mắt luôn sáng khỏe chính là nhiệm vụ hàng đầu .
    thực phẩm tốt cho mắt
    cách chống nắng hiệu quả
    giải độc gan trị mụn
    cách trị sẹo lồi lâu năm
    công thức kem trộn trắng da toàn thân an toàn , giúp da luôn sáng khỏe .

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Bệnh khó ngủ hay mất là bệnh mà khiến chúng ta gắp rất nhiều khổ sở và khó ngủ phải làm sao ? Có nhiều cách giải quyết vấn đề khó ngủ này như dùng thuốc , châm cứu ,... Chúng ta đã nghe nhiều về collagen nhưng có nhiều vấn đề mà ta còn thắc mắc như uống collagen có tác dụng gì ? Có an toàn không ? ..., uống gì mát gan, bệnh tai biến mạch máu não có chữa được không, thoai hoa dot song co uong thuoc gi. Để có một trí nhớ tốt có nhiều cách .làm thế nào để có trí nhớ tốt ? Như dùng thuốc , ăn nhiều trái cây ,.. sẽ giúp bộ não hoạt động tốt và trí nhớ sẽ rất tốt .

    ReplyDelete