Search This Blog

Monday, September 19, 2011

AX 2012 TempDB Tables

In Microsoft Dynamics AX, one type of temporary table is a TempDB table.

We call them TempDB tables because their TableType property value is TempDB. This value comes from the TableType::TempDB enum value. The TableType property value can be set at AOT > Data Dictionary > Tables > MyTempDBTable > Properties > TableType.

Only processes that run on the server tier can instantiate TempDB tables.

Following Sample will give the little picture about how to use the TempDb Tables

Create the Class with this main method and Run the class
server public static void main(Args _args)
{
    MyTempdb MyTempdb;
    CustTable custTable;
    TableType tableTypeEnum;
    str stringWork;
    ;
   
    info("Start of main.");
    MyTempdb;.AccountNum = "4004";
    MyTempdb;.doInsert();
    MyTempdb;.AccountNum = "4005";
    MyTempdb;.doInsert();
    tableTypeEnum = MyTempdb;.getTableType();
    stringWork = "MyTempdb.TableType is: " + enum2Str(tableTypeEnum);
    info(stringWork);
    while select *
            from custTable
                JOIN MyTempdb;
            where
                MyTempdb;.AccountNum == custTable.AccountNum
    {
        stringWork = custTable.AccountNum
                + " , "
                + int2Str(custTable.MandatoryCreditLimit);
        info(stringWork);
    }
}

No comments:

Post a Comment

Thanks for visiting my blog,
I will reply for your comment within 48 hours.

Thanks,
krishna.