Сводка. В этой статье рассмотрено создание таблиц SQL для microsoft Business Solutions — отличные программы на основе простоты.ДОПОЛНИТЕЛЬНЫЕ СВЕДЕНИЯ. Используйте эти потоки для создания SQL, которые находятся в интегрированной стороннее программу, написанную в тексте "Текостя". Кроме того, здесь вы можете предоставить SQL этим таблицам. Примечание. Этот метод заменяет метод amAutoGrant, описанный в главе 41 руководства по программированию с стьюстью (том 1).1. Создайте глобальную процедуру "Запуск", если она еще не существует в программе сторонних компаний. Этот сценарий запускается при запуске Great Plains и обычно регистрируется триггеры. 2. В сценарии запуска создайте триггер процедуры Add_Successful_Login_Record с помощью следующего кода:
{Name: Startup}local integer l_result; l_result = Trigger_RegisterProcedure(script Add_Successful_Login_Record, TRIGGER_AFTER_ORIGINAL, script gp_create_tables);if l_result <> SY_NOERR thenwarning "The Add_Successful_Login_Record trigger is not registered."; end if;
3. Зарегистрированный триггер, созданный на шаге 2, будет вызывать глобальную процедуру gp_create_tables при каждом входе пользователя в Microsoft Dynamics GP. Эта процедура происходит, когда компания Great Plains изначально открывается или открывается при смене пользователя или компании.4. Создайте глобальную процедуру с gp_create_tables. Этот сценарий создаст таблицы для программы сторонних авторов в правильной SQL Server базе данных. Кроме того, будет создана таблица, созданная на компьютере zDP, и SQL разрешения для таблицы и процедур. Используйте следующий код:
{Name: gp_create_tables} local boolean result,l_result,OUT_Access; {if logged in as sa, let them create the tables} if 'SQLSaUser' of globals then OUT_Access = true; else {This else statement will work only on 8.0. If logged in as a user other than sa, but they have table access permissions, let them create the tables} if syUserInRole('User ID' of globals, ROLE_SYSADMIN) or (syUserIsDBO ('User ID' of globals, 'Intercompany ID' of globals) and syUserIsDBO ('User ID' of globals, SQL_SYSTEM_DBNAME)) then OUT_Access = true; end if; end if; if 'SQL Server' of globals > 0 and OUT_Access then {enable table creation mode} result = Table_SetCreateMode(true); {Do not display any table errors to the user.} result = Table_DisableErrorChecks(true); {accessing the table creates it, list all your tables here, make sure to close the tables when done} get first table GPSetup; {Purchasing series table} close table GPSetup; get first table GPSetup2; {System series table} close table GPSetup2; {now set permissions, call once for the table and once for the stored procs} {GPSetup is a purchasing series table so that will be in the company dbo} l_result = GrantAccess(physicalname(table GPSetup),false,"DYNGRP",'Intercompany ID' of globals) of form 'SQL Maintenance'; l_result = GrantAccess(physicalname(table GPSetup),true,"DYNGRP",'Intercompany ID' of globals) of form 'SQL Maintenance'; {GPSetup2 is a system series table so that will be in the DYNAMICS database} l_result = GrantAccess(physicalname(table GPSetup2),false,"DYNGRP","DYNAMICS") of form 'SQL Maintenance'; l_result = GrantAccess(physicalname(table GPSetup2),true,"DYNGRP","DYNAMICS") of form 'SQL Maintenance'; {Turn off automatic table creation.} result = Table_SetCreateMode(false); {Turn table error reporting back on.} result = Table_DisableErrorChecks(false); end if;
5. Таблицы и хранимые процедуры, созданные таблицами, будут созданы в SQL Server и SQL будут предоставлены разрешения. Этот сценарий будет запускаться только для пользователей DYNSA и после создания таблиц можно снова запустить этот сценарий.Эта статья была посвящена ид.: 33429