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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 07.08.2008, 14:42   #1  
kuvshinka is offline
kuvshinka
Участник
 
5 / 10 (1) +
Регистрация: 07.08.2008
Частичное архивирование базы
Здравствуйте! Подскажите, пож-та, как можно реализовать следующее..
Появилась потребность архивировать некоторые таблицы базы, урезанные по определенному критерию..Поступило предложение использовать DTS, и при нажатии на кнопку в Аксапте запускать уже настроенные DTS. Как реализовать вызов в Аксапте? Может кто-то уже сталкивался с подобной задачей?
Старый 07.08.2008, 16:50   #2  
oip is offline
oip
Axapta
Лучший по профессии 2014
 
2,564 / 1416 (53) ++++++++
Регистрация: 28.11.2005
Записей в блоге: 1
Цитата:
Execute a DTS package from X++

Recently someone asked how to execute a DTS package from X++. This was a great question and great timing because I had just recently completed a project that had to execute a DTS package. Below is the code that will allow you to do this:

X++:
protected void runDTSpkg()
{
    OdbcConnection cn;
    ResultSet rs;
    Statement s;
    str SQL;
    str temp;
;
 
    // Open up a connection to the Master Database, and execute the DTS package
    cn = this.CN("master");
    s = cn.createStatement();
    SQL = "xp_cmdshell 'dtsrun /SVSQL /Usomeuser /Pblocked /NPumpOverCS_SHIP'";
    rs = s.executeQuery(SQL);
    while(rs.next())
    {
        // Here you could see if an error occurs, or just use this loop to allow the DTS to finsih.
        temp = rs.getString(1);
        MMI_ErrLog::logError("PkgScoop",strfmt("%1",temp));
    }
}
So there are a couple of things I want to point out here. One is the actual statement used to do this:

xp_cmdshell 'dtsrun /SVSQL /Usomeuser /Pblocked /NPumpOverCS_SHIP'
The /S = Server Name, /U = User Name, /P = Password /N = Name of DTS package to execute. Notice that the parms are ran together with what your passing. This Must happen or you get an error.

Another thing I wanted to point out was that I do a while(rs.next()) {...} for the resultset. When executing a DTS package through the stored procedure xp_cmdshell results are returned telling you about what is going on. You can read these results and act on them, or do like I do and just put them into a general log table. Whatever you do though, you must preform the while(rs.next()) {...} so you can allow the DTS to fully finish before you continue to your next block of code that I assume would operate on the data that the DTS package brought in / manipulated, etc.
http://dynamics-ax.blogspot.com/2006...ge-from-x.html
__________________
С уважением,
Олег.
Старый 07.08.2008, 17:06   #3  
Vadik is offline
Vadik
Модератор
Аватар для Vadik
Лучший по профессии 2017
Лучший по профессии 2015
 
3,631 / 1849 (69) ++++++++
Регистрация: 18.11.2002
Адрес: гражданин Москвы
ммм.. разрешенный xp_cmdshell.. несекьюрно как-то
__________________
-ТСЯ или -ТЬСЯ ?
Старый 08.08.2008, 11:31   #4  
kuvshinka is offline
kuvshinka
Участник
 
5 / 10 (1) +
Регистрация: 07.08.2008
oip, спасибо! попробуем..
Теги
документация

 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Ищу готовые базы Axapta locky_sql_ru DAX: Администрирование 25 28.02.2007 10:47
Размер базы Sergo DAX: Функционал 13 30.10.2006 12:17
Вопрос по журналу базы данных(лог) Hidden DAX: Функционал 2 21.09.2005 14:00
Отдельные базы, Компании или Фин. аналитика? YellowSubmarine DAX: Функционал 11 22.08.2005 15:19
Частичное списание стоимости ОС Anais DAX: Функционал 9 19.05.2004 05:33

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

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

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