SÚHRN
V tomto článku sa popisuje, ako vytvoriť SQL pre riešenia Microsoft Business Solutions – skvelé programy s jednoduchou pohyblivosťou. ĎALŠIE INFORMÁCIE Pomocou nasledujúcich krokov môžete vytvoriť SQL ktoré sú umiestnené v integrovanom programe tretej strany napísaného v dexterite. Tieto kroky zahŕňajú aj to, ako SQL na tieto tabuľky. Poznámka Táto metóda nahrádza metódu amAutoGrant, ktorá je popísaná v Kapitole 41 Príručky pre programátorov pohyblivosti, Volume 1. 1. Ak v programe tretej strany ešte neexistuje, vytvorte globálnu procedúru s názvom Spúšťanie. Tento skript sa spustí pri spustení programu Great Plains a v tomto prípade sú registrované spúšťače. 2. V skripte Spúšťanie vytvorte spúšťač procedúr na Add_Successful_Login_Record pomocou nasledujúceho kódu.{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 then warning "The Add_Successful_Login_Record trigger is not registered."; end if;
3. Zaregistrovaný spúšťač vytvorený v kroku 2 vyvolá globálny postup gp_create_tables pri každom prihlásení používateľa do systému Microsoft Dynamics GP. Tento postup sa spustí pri prvom otvorení spoločnosti Great Plains pri prechode používateľa alebo spoločnosti. 4. Vytvorte globálny postup s názvom gp_create_tables. Tento skript vytvorí tabuľky pre program tretej strany v správnom SQL Server databázy. Vytvorí sa tiež tabuľka generovaná uloženýmiprocedúrami (zDP procs) a SQL povolení pre tabuľku a procedúry. Použite nasledujúci kód.
{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. Tabuľky a uložené procedúry vytvorené tabuľkou sa vytvoria v SQL Server a SQL sa udejú ďalšie povolenia. Tento skript sa spustí len pre používateľov so systémomSA alebo DYNSA a po vytvorení tabuliek je v poriadku spustiť tento skript znova. Tento článok bol TechZnámená identifikácia dokumentu:33429