REZIME Ovaj članak govori o tome kako da napravite SQL za Microsoft poslovna rešenja – velika jednostavnost zasnovanih na programima zasnovanim na
jednostavnosti.
DODATNE INFORMACIJE Koristite pristupačnosti da biste kreirali SQL tabela koje se ne integrišu u program nezavisnog autora napisanog u 2010.
Ovi koraci pokrivaju i to kako SQL da dodeli dozvolu za te tabele.
Napomena Ovaj metod zamenjuje amAutoGrant metod opisan u 41. poglavlju vodiča za programere deksibilnosti, volume 1.
1. Kreirajte globalnu proceduru
pod imenom "Pokretanje" ako ona već ne postoji u programu nezavisnog rasta. Skripta se pokreće kada pokrenete "Velika čistoća" i obično je to mesto gde su okidači registrovani.
2. U
početnoj skripti kreirajte okidač procedure na Add_Successful_Login_Record pomoću sledećeg koda.
{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. Registrovani okidač kreiran u 2. koraku poziva globalnu proceduru gp_create_tables svaki put kada se korisnik prijavi u
Microsoft Dynamics GP. Ova procedura se pokreće kada se preduzeće Great Plains prvi put otvori kada se korisnik ili preduzeće prebace.
4. Kreirajte globalnu proceduru pod
imenom "gp_create_tables". Ova skripta će kreirati tabele za program nezavisnog nezavisnog SQL Server podataka. Kreiraće i tabelu generisanu uskladištenuprocedures (zDP procs) i dodeliti SQL dozvola za tabelu i procedure. Koristite sledeći 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. Tabele i tabele generisane uskladištene procedure biće kreirane u SQL Server SQL će biti dodeljene dozvole. Ova skripta će se pokrenuti samo za korisnike usluge SSA ili DYNSA i kada se tabele kreiraju, u redu je ponovo pokrenuti skriptu.
Ovaj članak je techKnowledge Document ID:33429