Skip to content
Microsoft SQL Server

SQL Server Error 262

Permission denied, unable to run a statement (CREATE, ALTER)

Severity 14 Logins & Permissions
Applies to: All supported SQL Server versions (2016 to 2025), Azure SQL Database, Azure SQL Managed Instance
Last technically reviewed 23 October 2026 on SQL Server 2025 (17.0.1145.4)
The full message
Msg 262, Level 14, State 1, Line 1
CREATE TABLE permission denied in database 'HR'.
Other forms of this message
CREATE PROCEDURE or CREATE VIEW (state 18; the header names the new object)
Msg 262, Level 14, State 18, Procedure GetEmployees, Line 1
CREATE PROCEDURE permission denied in database 'HR'.
Error number
262
Severity
14 (user-correctable error)
State
1 for CREATE TABLE, 18 for CREATE PROCEDURE and CREATE VIEW (reproduced)
Product
Microsoft SQL Server Database Engine
Versions
All supported SQL Server versions (2016 to 2025), Azure SQL Database, Azure SQL Managed Instance
Last reviewed
23 October 2026

What it means

Error 262 means the current user is not allowed to create that kind of object (table, view, procedure, function) in the database named in the message.

Creating an object needs a database permission for that statement, such as CREATE TABLE or CREATE PROCEDURE. The message names the statement and the database, so you know exactly which permission is missing. Reading and writing data (db_datareader, db_datawriter) never includes it, which is why an application account that has run for months can hit 262 the first time its code tries to create a table.

The engine raises 262 at severity 14 (a permission error), although sys.messages lists it at 16; we saw Level 14 in every reproduction. The state tells you which check failed: 1 for CREATE TABLE, 18 for CREATE PROCEDURE and CREATE VIEW. For permission to use an object that already exists, see error 229; for creating users, roles or schemas, see error 15247.

Common causes

  • An application or reporting account with only db_datareader and db_datawriter runs code that creates tables, views or procedures (for example migrations at application start-up).
  • A deployment runs under the wrong account, or in the wrong database, where the deploy account has no DDL rights.
  • A developer database was restored or refreshed and the extra grants made by hand were lost.
  • The account was given the CREATE permission but not ALTER on the target schema, which fails with error 2760 instead (see the third example).

Diagnose it

Read-only These queries only read metadata and dynamic management views. They do not change data, permissions or configuration, so they are safe to run first.

Confirm who you are and where

SELECT DB_NAME()         AS current_database,
       SUSER_SNAME()     AS login_name,
       USER_NAME()       AS database_user,
       ORIGINAL_LOGIN()  AS original_login;
What to look for

The database must match the one in the message. A different user than expected (for example guest or a group login) explains missing rights.

Check the CREATE permissions of the current connection

SELECT HAS_PERMS_BY_NAME(DB_NAME(), N'DATABASE', N'CREATE TABLE')     AS can_create_table,
       HAS_PERMS_BY_NAME(DB_NAME(), N'DATABASE', N'CREATE PROCEDURE') AS can_create_procedure,
       HAS_PERMS_BY_NAME(DB_NAME(), N'DATABASE', N'CREATE VIEW')      AS can_create_view,
       HAS_PERMS_BY_NAME(N'dbo', N'SCHEMA', N'ALTER')                 AS can_alter_dbo_schema;
What to look for

0 in a CREATE column is error 262. CREATE allowed but can_alter_dbo_schema = 0 leads to error 2760 instead.

List database-level grants to a user and its roles

SELECT pr.name AS principal, pe.permission_name, pe.state_desc
FROM sys.database_permissions AS pe
JOIN sys.database_principals AS pr ON pr.principal_id = pe.grantee_principal_id
WHERE pe.class = 0
  AND pe.permission_name LIKE N'CREATE%'
ORDER BY pr.name, pe.permission_name;
What to look for

Who holds which CREATE permission. Members of db_ddladmin and db_owner have them through the role, so they do not appear as rows here.

How to fix it

Each fix is labelled with what it changes. Try read-only checks and the least invasive fix first, and test changes outside production.

Run schema changes with the deployment account

Client or network side

Often the right fix is not a grant: run migrations and deployments with an account meant for schema changes, and keep the runtime application account limited to data access.

Grant the statement permission and ALTER on the schema

Changes permissions

The narrowest grant. The CREATE permission alone is not enough: the user also needs ALTER on the schema the object goes into, otherwise the statement fails with error 2760.

GRANT CREATE TABLE TO [AppUser];
GRANT ALTER ON SCHEMA::dbo TO [AppUser];

Add a deployment account to db_ddladmin

Changes permissions

db_ddladmin can create, alter and drop objects in any schema of the database, without the data access and security rights of db_owner. Use it for accounts that deploy schema changes.

ALTER ROLE db_ddladmin ADD MEMBER [DeployUser];

Examples

CREATE TABLE denied (state 1)

CREATE USER AppUser WITHOUT LOGIN;
ALTER ROLE db_datareader ADD MEMBER AppUser;
ALTER ROLE db_datawriter ADD MEMBER AppUser;

EXECUTE AS USER = 'AppUser';
CREATE TABLE dbo.AuditLog (id INT PRIMARY KEY, action NVARCHAR(100));
REVERT;
Result
Msg 262, Level 14, State 1, Line 6
CREATE TABLE permission denied in database 'HR'.

Reproduced on SQL Server 2025 (17.0.1145.4), 23 October 2026.

CREATE PROCEDURE denied (state 18)

CREATE USER AppUser WITHOUT LOGIN;
ALTER ROLE db_datareader ADD MEMBER AppUser;
ALTER ROLE db_datawriter ADD MEMBER AppUser;
EXECUTE AS USER = 'AppUser';
GO
CREATE PROCEDURE dbo.GetEmployees
AS
    SELECT 1 AS id;
GO
REVERT;
Result
Msg 262, Level 14, State 18, Procedure GetEmployees, Line 1
CREATE PROCEDURE permission denied in database 'HR'.

Reproduced on SQL Server 2025 (17.0.1145.4), 23 October 2026.

CREATE TABLE granted, but no ALTER on the schema (error 2760)

This example shows error 2760, not 262: after you grant CREATE TABLE, the next failure is the missing ALTER permission on the schema. Grant both, as in the second fix.

CREATE USER AppUser WITHOUT LOGIN;
GRANT CREATE TABLE TO AppUser;

EXECUTE AS USER = 'AppUser';
CREATE TABLE dbo.AuditLog (id INT PRIMARY KEY, action NVARCHAR(100));
REVERT;
Result
Msg 2760, Level 16, State 1, Line 5
The specified schema name "dbo" either does not exist or you do not have permission to use it.

Reproduced on SQL Server 2025 (17.0.1145.4), 23 October 2026.

How to prevent it

Separate the account that changes the schema from the account the application runs as. The runtime account gets data access only; the deployment account gets db_ddladmin or narrow CREATE and ALTER grants. Applications that run migrations at start-up should use the deployment credentials for that step.

Keep grants in scripts under source control and re-run them after restoring or refreshing a database, so environments do not drift. Test deployments with the real deployment account rather than an administrator, so 262 shows up before release.

Common questions

Why does error 262 show Level 14 when sys.messages says severity 16?

The severity in sys.messages is only the default stored with the message text; the permission check raises 262 at its own level. On SQL Server 2025 every 262 we reproduced came back at Level 14, so error handling that checks ERROR_SEVERITY() should expect 14.

Which role lets a user create tables?

db_ddladmin (or db_owner, which is far broader). For one statement only, grant CREATE TABLE plus ALTER on the target schema.

I granted CREATE TABLE and now get error 2760. Why?

The table is created in a schema, and that needs ALTER on the schema as well. Grant ALTER ON SCHEMA::dbo (or the target schema) to the same user or role.

Learn more on CodeWithSQL

Official documentation

Last technically reviewed 23 October 2026; examples and diagnostics run on SQL Server 2025 (17.0.1145.4). Message text checked against the engine's sys.messages catalogue.

Still stuck on a SQL Server error?

Browse the full SQL Server error library, or get hands-on help from an experienced SQL professional.