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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 09.08.2012, 19:12   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
emeadaxsupport: Temporary Tables (AX 2012)
Источник: http://blogs.msdn.com/b/axsupport/ar...s-ax-2012.aspx
==============

Set/Link Data on
Temporary Tables (AX 2012)

In Ax 2012, the Temporary property on tables was
replaced with a new property: TableType, which has three possible
values:
  • Regular - a standard
    physical table
  • InMemory - the type
    of temporary table which existed in the previous versions of Dynamics Ax.
    Such tables are held in memory and written to a local disk file once they
    grow beyond a certain point
  • TempDB - a new
    option in Ax 2012. They are "physical" temporary tables held in
    the SQL Server database.
The new TempDB tables operate in a similar manner to InMemory
tables but support more features of standard physical tables:
  • More powerful
    joins with physical tables are possible, and are properly supported by the
    database
  • Can be
    per-company or global
  • Support for
    normal tts transactions
To create
a new instance link (populating data/copying reference) from one table instance
variable to the other with Temporary type tables:
Code Examples:

-
Open AOT/Data Dictonary/Tables

-
Create a New table, name it "TestTmp"

-
Expand it, create a new field of type string and name it "Id"

1)
InMemory:

- Set
the "TestTmp" table "TableType" property to
"InMemory", save

- Create
and run following job:

static void TestTmpInMemory(Args _args)

{

TestTmp tmp1, tmp2;

;

tmp1.Id = "1000";

tmp1.insert();



tmp2.setTmpData(tmp1);



info("Table
type: " + enum2Str(tmp1.getTableType()));



info("tmp1
data begin: ");



while
select tmp1

info(" Id " + tmp1.ID);



info("tmp1
data end.");



info("tmp2
data begin: ");



while
select tmp2

info(" Id " + tmp2.ID);



info("tmp2
data end.");

}



2)
TempDB:

- Set
the "TestTmp" table "TableType” property to "TempDB",
save

- Create
and run following job:

static void TestTmpTempDB(Args _args)

{

TestTmp tmp1, tmp2;

;

tmp1.Id = "1000";

tmp1.insert();



tmp2.linkPhysicalTableInstance(tmp1);



info("Table
type: " + enum2Str(tmp1.getTableType()));



info("tmp1
data begin: ");



while
select tmp1

info(" Id " + tmp1.ID);



info("tmp1
data end.");



info("tmp2
data begin: ");



while
select tmp2

info(" Id " + tmp2.ID);



info("tmp2
data end.");

}



Author: Mansour Yahya Mohammad

Date: 9/8-2012






Источник: http://blogs.msdn.com/b/axsupport/ar...s-ax-2012.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
Старый 10.08.2012, 09:53   #2  
Lemming is offline
Lemming
Участник
Аватар для Lemming
 
1,144 / 343 (14) ++++++
Регистрация: 20.04.2004
Адрес: Москва, Чайнатаун в Люблино
Записей в блоге: 10
?
Довольно элегантно они придумали переход от временных таблиц работающих на внутреннем движке аксапты, к временным таблицам СУБД. Интересно что будет если таблицу с InMemory сменить на TempDB, как в таком случае отработает первый Job из приведенного поста?

А еще интересно можно ли из кода сделать что-то вроде setTmp() для постоянной таблицы, но что бы такая табличная переменная работала по принципу TempDB?
Старый 10.08.2012, 10:24   #3  
oip is offline
oip
Axapta
Лучший по профессии 2014
 
2,564 / 1416 (53) ++++++++
Регистрация: 28.11.2005
Записей в блоге: 1
Цитата:
Сообщение от Lemming Посмотреть сообщение
Интересно что будет если таблицу с InMemory сменить на TempDB, как в таком случае отработает первый Job из приведенного поста?
Просто не сработает setTmpData, tmp2, очевидно, будет пустой, и в инфологе для нее будет только
Цитата:
tmp2 data begin:
tmp2 data end.
Цитата:
Сообщение от Lemming Посмотреть сообщение
А еще интересно можно ли из кода сделать что-то вроде setTmp() для постоянной таблицы, но что бы такая табличная переменная работала по принципу TempDB?
Аналога метода settmp, чтобы получить TempDB таблицу, нет.
__________________
С уважением,
Олег.
За это сообщение автора поблагодарили: Lemming (1), S.Kuskov (2).
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
ax-erp: Creating SSRS-Reports in Dynamics AX 2012 – What’s no longer possible in AX-reports Blog bot DAX Blogs 0 18.07.2012 12:11
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11
axdaily: SQL temporary tables in AX 2012 Blog bot DAX Blogs 25 06.05.2011 10:18
axinthefield: Dynamics AX Event IDs Blog bot DAX Blogs 0 01.03.2011 22:11
daxdilip: Whats New in Dynamics AX 2012 (A brief extract from the recently held Tech Conf.) Blog bot DAX Blogs 7 31.01.2011 12:35

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

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

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