Hello,

On Sonntag, 16. Februar 2003 06:25, Girish Mohata wrote:
> I have 2 databases in my SAP DB installation DB1 and DB2.
> DB1 has 3 tables T_A and T_B.
> DB2 has a procedure P_1.
>
Thislooks like something you would do with M$ access or a system like that.
With sapdb, you shouldn't.

> My question:
> Can i write a procedure in the DB2's schema which accesses data from tables
> which are in DB1's Schema ?
> Can DB1 execute the procedures which belong to DB2's schema ?
>
this you can, but they have to be within the same database.

you create two users. One of them owns the tables, the other one the 
procedures. 
The table owner grants select (or updtae, or what else) to the procedure owner
The procdure owner grants execute on the procedure to the table owner.
then you have the choice to either access the other person's tables by 
prefixing them with the schema name or to create synonyms (aliases) and to 
omit the schema name. For the procedure you can however not create a synonym.

        create user fred ...
        create user bob ...
login as fred
        create table payroll
        grant select on payroll to bob
logout
login as bob
        select * from fred.payroll 
or
        create synonym payroll for fred.payroll
and from then on
        select * from payroll 
and
        create dbproc salaryraise
        grant execute on salaryraise to fred
logout
login as fred
        call bob.salaryraise

should work.

Peter Willadt

_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to