I have two Microsoft SQL Server 2000 databases, and a stored procedure on one tries to read data from the other. This used to work fine, but since I became security-conscious and changed the login (SQL user) from "db owner" to "denydatareader" the call fails.
I can get things working if I use the group "datareader", but since I do not want this login to have read access to user tables (the ASPs use only procs), I thought this unwise. It also works if I take the user out of all groups!!! Is this OK?
One database is called 'Internal' and has a table called 'Stuff'. The other is called 'WebFacing' and has a stored procedure called 'Get_Some_Data' which SELECTs from 'Internal..Stuff'.
I ran this command on the Internal database:
GRANT SELECT ON Stuff TO magnus
I ran this one on the WebFacing database:
GRANT EXECUTE ON Get_Some_Data TO magnus
My ASP uses the SQL login 'magnus' and connects to the 'WebFacing' database.
When it tries to EXEC the procedure, it errors with:
SELECT permission denied on object 'Stuff', database 'Internal', owner 'dbo'.
(Apologies if this is a dumb question, but I've been shoved in the deep end and only learnt about GRANT and DENY yesterday. I have tried Googling...)