MS SQL Server Concepts and Programming Question:
Download Questions PDF

What Happens If You Are Trying to Access a Schema Not Owned by You?

Answer:

In general, if you are trying to access an object in schema owned by another database user, you will get a "permission denied" error, unless that you have been granted access permission to that object explicitly. Here is a tutorial example showing you the permission error:

-- Login with "ggl_login"

USE GlobalGuideLineDatabase;
GO

PRINT User_Name();
GO
ggl_User

SELECT COUNT(*) FROM dbo.ggl_random;
GO
Msg 229, Level 14, State 5, Line 1
SELECT permission denied on object 'ggl_random',
database 'GlobalGuideLineDatabase', schema 'dbo'.


Download MS SQL Server Interview Questions And Answers PDF

Previous QuestionNext Question
How To Change the Ownership of a Schema in MS SQL Server?How To Drop an Existing Schema in MS SQL Server?