SQL Server error 262: Permission denied in database
You tried a statement that needs a database-level permission you don't have, such as CREATE TABLE, CREATE PROCEDURE or SHOWPLAN.
- Error number
262- Severity
- 16
- Category
- Permissions
What it means
Some statements are not about one object but need a permission on the database itself: CREATE TABLE, CREATE VIEW, CREATE PROCEDURE, SHOWPLAN and so on. Error 262 names the permission (for example CREATE TABLE permission denied in database 'SalesDb').
Common causes
- The user can read and write data but was never granted DDL permissions.
- Viewing an execution plan without
SHOWPLANpermission. - Creating an object in a schema you don't own and have no
ALTERpermission on (CREATE TABLEalso needsALTERon the schema).
How to fix it
-
Grant the database permission and, for creating objects,
ALTERon the target schema.GRANT CREATE TABLE TO app_user; GRANT ALTER ON SCHEMA::dbo TO app_user;
-
For execution plans, grant
SHOWPLAN.GRANT SHOWPLAN TO app_user;
-
For a developer who needs full DDL rights in a dev database, add them to
db_ddladmin.ALTER ROLE db_ddladmin ADD MEMBER dev_user;
Related errors
229Permission denied on object916Login can't access the database1227MySQL: Access denied; you need a privilege42501PostgreSQL: permission deniedORA-01031Oracle: insufficient privileges
More permissions errors
15151Object doesn't exist or no permission15023User, group, or role already exists15025The server principal already exists15138User owns a schema, cannot be dropped
The code and message text are from the Microsoft Database Engine events and errors reference. Browse the full SQL Server error list or search every database error.
Work on SQL Server in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for SQL Server and the other databases you use.