What Happens If You Are Trying to Access a Schema Not Owned by You?
Submitted by: AdministratorIn 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'.
Submitted by: Administrator
-- 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'.
Submitted by: Administrator
Read Online MS SQL Server Job Interview Questions And Answers
Top MS SQL Server Questions
☺ | How To Select Some Specific Rows from a Table in MS SQL Server? |
☺ | PHP MSSQL - How To Display a Past Time in Days, Hours and Minutes? |
☺ | Does Index Slows Down INSERT Statements? |
☺ | How To Execute the Cursor Queries with "OPEN" Statements? |
☺ | What Happens If Strings Are Casted into Wrong Code Pages in MS SQL Server? |
Top Databases Programming Categories
☺ | RDBMS Interview Questions. |
☺ | SQL Interview Questions. |
☺ | SSRS Interview Questions. |
☺ | Sybase Interview Questions. |
☺ | Database Administrator (DBA) Interview Questions. |