Hello,
So in previous versions prior to DAX4 there was a recId allocation per company. I believe starting from DAX4 it changed and now it is per table. I am wondering if having the same RecId in a table for different companies can cause any issues in the future.
Basically, I have now DAX2009, and there I have duplicated RecIds in a table, however the dataAreaId is different for those duplicated RecIds. I assume it shouldn?t cause any issues since all indexes use the dataAreaId, but just wanted to confirm.
Thanks,
Gary
Gandhinath Swaminathan [MSFT] wrote:
Please do not use direct SQL against system tables especially systemSequences.
05-Dec-08
Please do not use direct SQL against system tables especially
systemSequences. This table is responsible for RECID/TRANSACTIONID/EVENTID.
So, there is lot of logic around this table. Also, we have to accomodate for
pre-4.0 environments where RECID was per company and after that release,
RECID is per table. So we manage that as well in the kernel
Use SystemSequence class and RESERVATION API mechanism rather than using
direct SQL. This functionality will suffice your requirements
--
This posting is provided "AS IS" with no warranties, and confers no right
"Adam" <***@discussions.microsoft.com> wrote in message news:026ED618-D735-44C5-B604-***@microsoft.com...
Previous Posts In This Thread:
On Wednesday, December 03, 2008 4:39 PM
Ada wrote:
SystemSequences Table
Hello
I notice that when I insert a record into an empty table (through the AX UI)
a record is added to the SystemSequences table which tells me what the next
record id will be in the table which had the data inserted.
When I create a new company with an empty database, as I add records to the
various empty tables, they are assigned record ids, but there is nothing
inserted into the systemsequences table. Does anyone know how AX is
generating the record ids for my second company when there is no
corresponding row in the systemsequences table
Any insight into this topic would be a great help
Thanks
Adam
On Wednesday, December 03, 2008 4:55 PM
kashperuk(at)mail(dot)ru(nospam) wrote:
Well, first of all, we need to find out what AX version you are using.
Well, first of all, we need to find out what AX version you are using
I am assuming 4.0 or later. In this case, the records in SystemSequences
table are not stored per company. Therefore, for any company you create, the
RecId will be taken from the same value range, depending only on the Table
where the record is inserted
Note as well, that the AOS caches a number (200 by default, afair) of RecId
values for each table, so that it does not have to read/update the
SystemSequences table for each insert() performed. The nextVal value, of
course, is updated by 200 at once
--
Kashperuk Ivan (Vanya), SDET, Inventory management, Microsoft Dynamics A
My blog - http://kashperuk.blogspot.co
Download MorphX IT in Russian - http://www.lulu.com/content/72388
"Adam" wrote:
On Wednesday, December 03, 2008 6:29 PM
Ada wrote:
Hello Ivan,Thanks a lot for the info!
Hello Ivan
Thanks a lot for the info
We are using AX 2009 SP1 and direct SQL statements to insert data into AX
tables. Is there a way to identify the next available record id for various
tables if that data is cached? Is it possible that I can flush the cache to
update the systemsequences table so that I can get the correct nextval?
Thanks again
Ada
"Kashperuk Ivan (Vanya)" wrote:
On Wednesday, December 03, 2008 7:33 PM
kashperuk(at)mail(dot)ru(nospam) wrote:
Well, I think that you can simply disregard the cached records.
Well, I think that you can simply disregard the cached records. Considering
that RecId is an Int64, you will never run out of RecIds
--
Kashperuk Ivan (Vanya), SDET, Inventory management, Microsoft Dynamics A
My blog - http://kashperuk.blogspot.co
Download MorphX IT in Russian - http://www.lulu.com/content/72388
"Adam" wrote:
On Wednesday, December 03, 2008 7:38 PM
Ada wrote:
Hello again,I did a little research and what you said before makes more sense.
Hello again,
I did a little research and what you said before makes more sense. It looks
like the range of record ids are cached on the client and the nextval is
already updated. So the caching of records is not going to cause me any
problem and I won't need to flush the cache.
Now there is just one small problem which is if there is a table which does
not contain any records. In this case, there is no record in the
systemsequences table. I am just planning to insert a record into that table
in this case but I want to confirm that the values I'm planning to insert are
ok. Below I listed all the values. The main question is on NextVal and
DataAreaId. I notice that AX always uses NextVal 5637144576. Is there any
reason I should use this number instead of 1? Also on the DataAreaId, I can
enter the company name that I'm currently working with but does it even
matter if the number sequences are shared? Is this just a field form
previous AX versions that is no longer used? And does anything else below
look like it will be a problem?
ID: -1
NextVal: 1? 5637144576?
MinVal: 1
MaxVal: 9223372036854775807
Cycle: 0
Name: SEQNO
TabID: [The table id which is having data inserted]
DataAreaId: [The company which I am inserting data into, but does it even
matter?]
RecVersion: 1
RecId: -1
Thanks again for all the help,
Adam
"Adam" wrote:
On Thursday, December 04, 2008 11:36 AM
Ada wrote:
Thanks again, I think you're right, the cache will not cause any problems as
Thanks again, I think you're right, the cache will not cause any problems as
long as I update the nextVal in the systemSequences table.
Sometimes I'll need to create a record in the SystemSequences table (if I am
inserting into an empty table). In this case, what should I use for the
initial value of the NextVal? I notice that AX uses 5637144826 but I'm not
sure if that's just the demo data that I'm using. Is this an OK number? Is
there any reason not to start from 1?
Thanks again for all the help,
Adam
"Kashperuk Ivan (Vanya)" wrote:
On Thursday, December 04, 2008 5:29 PM
kashperuk(at)mail(dot)ru(nospam) wrote:
You should not start it from 1.
You should not start it from 1. These values were reserved for some system
stuff and prev.versions support. It might be safe specifically in your
situation, but I would still recommend using the same start value as Dynamics
AX does by default.
Other than that, I think everything should go OK with creating a record
yourself.
--
Kashperuk Ivan (Vanya), SDET, Inventory management, Microsoft Dynamics AX
My blog - http://kashperuk.blogspot.com
Download MorphX IT in Russian - http://www.lulu.com/content/723888
"Adam" wrote:
On Thursday, December 04, 2008 6:43 PM
Ada wrote:
RE: SystemSequences Table
Great, thanks again!
"Kashperuk Ivan (Vanya)" wrote:
On Friday, December 05, 2008 12:44 PM
Gandhinath Swaminathan [MSFT] wrote:
Please do not use direct SQL against system tables especially systemSequences.
Please do not use direct SQL against system tables especially
systemSequences. This table is responsible for RECID/TRANSACTIONID/EVENTID.
So, there is lot of logic around this table. Also, we have to accomodate for
pre-4.0 environments where RECID was per company and after that release,
RECID is per table. So we manage that as well in the kernel.
Use SystemSequence class and RESERVATION API mechanism rather than using
direct SQL. This functionality will suffice your requirements.
--
This posting is provided "AS IS" with no warranties, and confers no rights
"Adam" <***@discussions.microsoft.com> wrote in message news:026ED618-D735-44C5-B604-***@microsoft.com...
Submitted via EggHeadCafe - Software Developer Portal of Choice
Custom Favorites Web Site with MongoDb and NoRM
http://www.eggheadcafe.com/tutorials/aspnet/7fbc7a01-5d30-4cd3-b373-51d4a0e1afa8/custom-favorites-web-site-with-mongodb-and-norm.aspx