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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 26.06.2017, 19:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
stoneridgesoftware: Updating the Next Rec ID Sequence in Dynamics AX
Источник: https://stoneridgesoftware.com/updat...n-dynamics-ax/
==============

Recently I had to create database records outside of Dynamics AX. I used SQL to move some records from ISV tables to new standard tables within AX. There was a ton of data, so it was much faster to insert these records using SQL. Initially, I overlooked one important factor. When I created these records outside of the AX environment, the SystemSequences table was not updated.

The SystemSequences table stores the next RecID by table in the AX environment: https://msdn.microsoft.com/en-us/lib...sequences.aspx
If this table is not updated properly, the users will see duplicate record errors that may not make sense to you. The users had sent me this error below. When I looked at the data, the Load ID did not exist. It didn’t throw an error about Rec IDs, so it’s a bit misleading.



The issue was that I had created records in the WHSLoadTable outside of AX.  The SystemSequences table wasn’t updated, so the next value of the Rec ID was incorrect and throwing an error. In this situation, you must update the SystemSequences table. You’ll need to find the max value for the table and update to the max value + 1.

Here is a portion of the SQL used to fix this issue:

DECLARE @MaxRecID BIGINT DECLARE @NextVal BIGINTSELECT @MaxRecID = MAX(RECID)FROM WHSLoadTableSELECT @NextVal = NEXTVAL FROM SYSTEMSEQUENCES INNER JOIN SQLDICTIONARY ON SQLDICTIONARY.FIELDID = 0 AND SQLDICTIONARY.name = 'WHSLoadTable' AND SQLDICTIONARY.TABLEID = SYSTEMSEQUENCES.TABID IF (@NextVal > @MaxRecID) BEGIN PRINT 'WHSLoadTable did not need to be updated.' END ELSE BEGINPRINT 'Updated WHSLoadTable from ' + CONVERT(VARCHAR(MAX), @NextVal) + '' to '' + CONVERT(VARCHAR(MAX), @MaxRecID + 1) UPDATE SYSTEMSEQUENCES SET NEXTVAL = @MaxRecID + 1 FROM SYSTEMSEQUENCES INNER JOIN SQLDICTIONARY ON SQLDICTIONARY.FIELDID = 0 AND SQLDICTIONARY.name = 'WHSLoadTable' AND SQLDICTIONARY.TABLEID = SYSTEMSEQUENCES.TABIDENDI hope this helps you out!



Источник: https://stoneridgesoftware.com/updat...n-dynamics-ax/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
stoneridgesoftware: How to Configure Access for Scribe Online for Dynamics AX 7 Integration Blog bot DAX Blogs 0 22.09.2016 06:12
stoneridgesoftware: TFS Code Repository and Dynamics AX Blog bot DAX Blogs 0 16.06.2016 16:11
crminthefield: Podcast and Overview: Microsoft Dynamics CRM 2011 Update Rollup 13 Blog bot Dynamics CRM: Blogs 0 27.03.2013 22:12
dynamics-ax: Official Details about Dynamics AX '6' released, including comments from Microsofts Kees Hertogh Blog bot DAX Blogs 0 11.01.2011 05:22
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

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

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

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 13:28.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.