mssql
Microsoft SQL Server Error Codes
Numeric error codes (Msg numbers) raised by the Microsoft SQL Server database engine, covering authentication, connectivity, constraint violations, and consistency errors.
25 codes
references learn.microsoft.com/en-us/sql/relational-databases/errors-events/database-engine-events-and-errors
· All codes 25 codes
- 53 Named Pipes Provider - Could Not Open a Connection to SQL Server The client could not reach the SQL Server instance over the network, often reported as 'Named Pipes Provider: Could not open a connection to SQL Server [53]'. Common causes are an incorrect server or instance name, the SQL Server Browser service not running for a named instance, a firewall blocking the port, or remote connections not being enabled on the server.
- 102 Incorrect Syntax Near The T-SQL parser encountered a token it did not expect, typically from a typo, a missing comma, or a reserved word used incorrectly. Check the statement immediately around the reported token for malformed syntax.
- 156 Incorrect Syntax Near the Keyword A T-SQL statement used a reserved keyword (such as ORDER, PRIMARY, or KEY) where an identifier was expected. Quote the identifier with square brackets or rename it to avoid the collision.
- 207 Invalid Column Name A query referenced a column that does not exist on the specified table or view. Usually caused by a typo, a schema change that has not been deployed everywhere, or a stale cached query/ORM model that no longer matches the table definition.
- 208 Invalid Object Name A query referenced a table, view, or other object that does not exist, or that the executing user/login cannot see. Common causes are a typo, a missing schema prefix, the wrong database context, or a deployment that has not yet created the object.
- 233 No Process Is on the Other End of the Pipe The connection was established but closed before the login handshake finished, typically surfaced as 'Shared Memory Provider: No process is on the other end of the pipe.'. This can occur when the instance is still starting up, when a forced-encryption setting mismatches between client and server, or when the server's connection limit has been reached.
- 245 Conversion Failed When Converting Value An implicit or explicit CAST or CONVERT could not convert a value to the target data type, most often because a string value is not valid for the numeric, date, or other typed column it is being compared with or inserted into. Check the data being supplied and the data type of the destination column or expression.
- 515 Cannot Insert the Value NULL into Column An INSERT or UPDATE attempted to set a NOT NULL column to NULL, either by omitting the column or by passing NULL explicitly with no default constraint defined. Supply a value for the column or add a DEFAULT constraint.
- 547 FOREIGN KEY or CHECK Constraint Conflict An INSERT, UPDATE, or DELETE statement conflicted with a FOREIGN KEY or CHECK constraint. For inserts and updates, the referenced row does not exist; for deletes, dependent rows still reference the row being removed. The constraint name in the error message identifies which constraint was violated.
- 701 Insufficient System Memory in Resource Pool SQL Server could not allocate enough memory from the specified Resource Governor pool to run the query, typically under memory pressure from large sorts, hashes, or memory grants. Tune the query, increase the resource pool's memory allocation, or add memory to the server.
- 824 Logical Consistency-Based I/O Error SQL Server detected page corruption while reading data, such as a checksum, torn-page, or page ID mismatch. This indicates underlying storage, filesystem, or hardware corruption. Run DBCC CHECKDB immediately to assess the damage, restore from a known-good backup if corruption is confirmed, and investigate the storage subsystem.
- 926 Database Cannot Be Opened - Restore In Progress The database was left in RESTORING state, usually because a multi-step restore sequence used WITH NORECOVERY and was never completed. Finish the restore chain WITH RECOVERY to bring the database back online.
- 1105 Could Not Allocate Space - Filegroup Full A write or index operation ran out of space because the target filegroup is full and autogrowth is disabled or the underlying disk is full. Free disk space, enable autogrowth, or add a file to the filegroup.
- 1205 Transaction Was Deadlocked - Chosen as Deadlock Victim Two or more transactions held locks that blocked each other in a cycle, and the deadlock monitor terminated this transaction to break it. The application should catch this error and retry the transaction. Capture a deadlock graph (via the system_health session or a trace) to identify and reduce the lock contention.
- 1222 Lock Request Time Out Period Exceeded A statement was blocked waiting for a lock longer than the configured LOCK_TIMEOUT setting and was cancelled. This usually points to long-running transactions or a blocking chain; identify the head blocker (e.g. via sys.dm_exec_requests) and shorten the transactions holding locks.
- 2601 Cannot Insert Duplicate Key Row in Unique Index An INSERT or UPDATE attempted to create a duplicate key value in a unique, non-primary-key index, and the statement was terminated. This is the unique-index counterpart of error 2627; the message identifies the index name and the duplicated key value.
- 2627 Violation of PRIMARY KEY or UNIQUE Constraint An INSERT or UPDATE attempted to create a duplicate value in a column protected by a PRIMARY KEY or UNIQUE constraint, and the statement was terminated. Find the conflicting row and either remove the duplicate, change the value being inserted, or use a MERGE / 'IF NOT EXISTS' pattern to avoid the collision.
- 3417 Cannot Recover the Master Database SQL Server failed to start because the master database is missing, inaccessible, or corrupt. Since the instance cannot run without master, recovery requires starting the instance with the -f (minimal configuration) startup option and restoring master from a backup, or rebuilding the system databases via setup.
- 3701 Cannot Drop - Object Does Not Exist or No Permission A DROP statement targeted a table, trigger, or other object that either does not exist or the caller lacks permission to drop. Verify the object name and schema, and confirm the caller has the required permission.
- 4060 Cannot Open Database Requested by the Login The login succeeded, but the requested database could not be opened. Typical causes are the database name being misspelled, the database not existing on this server, the login having no user mapping in that database, or the database being offline or in single-user mode.
- 8115 Arithmetic Overflow Error Converting Expression A computed value exceeded the range of its target data type during an implicit or explicit conversion, such as an int overflow from COUNT() on a large table. Use a wider type (e.g. COUNT_BIG, bigint) or cast explicitly.
- 8134 Divide by Zero Error Encountered An expression attempted to divide by zero using the / operator or a modulo operation. Guard the divisor with a CASE expression or NULLIF(divisor, 0), or be aware that SET ARITHABORT / ANSI_WARNINGS settings affect whether this aborts the statement or returns NULL.
- 8152 String or Binary Data Would Be Truncated A value being inserted or updated is longer than the target column allows. Increase the size of the column, truncate or validate the value before sending it, or, on SQL Server 2019 and later, enable trace flag 460 / use error 2628 to get the offending column name in the message.
- 18452 Login Failed - Not Associated with a Trusted SQL Server Connection The client attempted to connect with Windows Authentication, but the login is not associated with a trusted SQL Server connection, or the connection comes from a domain that the server's domain does not trust. Switch to SQL Server Authentication with a valid login, or resolve the domain trust relationship.
- 18456 Login Failed for User Authentication to the SQL Server instance failed. The most common causes are an incorrect username or password, a disabled login, SQL Server Authentication not being enabled on the server, or a locked-out account. The accompanying state number in the SQL Server error log narrows down the exact cause.