1

How to insert recId in dynamics Ax table SSIS?

4

3 回答 3

5

不要做。

但如果你坚持:http ://daxguy.blogspot.dk/2010/03/dynamics-ax-2009-bulk-data-insert-using.html

于 2013-04-29T13:56:33.093 回答
3

如果您想使用 SSIS 将记录直接插入到 SQL 数据库中,则无法单独从 SQL 操作中轻松获取 RecId,因此另一种选择是在 x++ 作业或服务中使用 x++ 保留 recid,例如:

static void ReserveRecs(Args _args)
{
    systemSequence seq;

    seq = new SystemSequence();
    if (seq)
    {
        // Suspend automatic recId allocation.
        Seq.suspendRecIds(tableName2id("TableName"));
        //Change the number below to reflect the amount of recid's you want reserved.
        info(int642str(seq.reserveValues(1, tableName2id("TableName"))));
        Seq.removeRecIdSuspension(tableName2id("TableName"));
    }
}

该作业将占用一张桌子,并保留一个 recId 以供系统简单地忽略/跳过。需要注意的是,如果您不小心保留了一个巨大的数字,那么恢复这些保留并不容易,而且 int64 确实有一个限制(尽管数量很大)。

您可能可以在 x++ 中创建一个服务,您可以从您的 SSIS 作业中找到该服务,您可以在其中告诉表名和要保留的数量,然后返回一个 int64,这样您就可以自动化 SSIS 作业。

于 2013-04-29T18:45:56.017 回答
0

在这篇文章中解释了如何维护数字序列表以插入 RecId,尽管这是一个必须始终避免的危险操作。

http://sumitsaxfactor.wordpress.com/2011/04/01/handling-recids-in-sql-server/

于 2013-05-07T15:39:14.777 回答