摘要 本文讨论如何为 Microsoft Business Solutions - SQL标准型程序创建表。详细信息 使用 thefollowingsteps SQL位于以 Dexterity 编写的集成第三方程序中的表。 这些步骤还涉及如何向这些SQL授予访问权限。 注意 此方法替换了《Dexterity 程序员指南》第 41 章(第 1 卷)中所述的 amAutoGrant 方法。1. 创建名为 Startup 的全局过程(如果第三方程序中 不存在)。此脚本在启动 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 procs (创建生成的) ,并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权限。此脚本仅对SA 或 DYNSA 用户运行,创建表后,可以再次运行此脚本。本文为 TechKnowledge 文档 ID:33429

TechKnowledge 内容

需要更多帮助?

需要更多选项?

了解订阅权益、浏览培训课程、了解如何保护设备等。