Skip to content

Latest commit

 

History

History
35 lines (31 loc) · 1.74 KB

File metadata and controls

35 lines (31 loc) · 1.74 KB
title SQLState Property | Microsoft Docs
ms.prod sql
ms.prod_service connectivity
ms.technology connectivity
ms.custom
ms.date 01/19/2017
ms.reviewer
ms.topic conceptual
apitype COM
f1_keywords
Error::GetSQLState
Error::SQLState
Error::get_SQLState
helpviewer_keywords
SQLState property
ms.assetid f9e25967-54b0-444d-af2a-0d2c75365d3e
author MightyPen
ms.author genemi

SQLState Property

Indicates the SQL state for a given Error object.

Return Value

Returns a five-character String value that follows the ANSI SQL standard and indicates the error code.

Remarks

Use the SQLState property to read the five-character error code that the provider returns when an error occurs during the processing of an SQL statement. For example, when using the Microsoft OLE DB Provider for ODBC with a Microsoft SQL Server database, SQL state error codes originate from ODBC, based either on errors specific to ODBC or on errors that originate from Microsoft SQL Server, and are then mapped to ODBC errors. These error codes are documented in the ANSI SQL standard, but may be implemented differently by different data sources.

Applies To

Error Object

See Also

Description, HelpContext, HelpFile, NativeError, Number, Source, and SQLState Properties Example (VB)
Description, HelpContext, HelpFile, NativeError, Number, Source, and SQLState Properties Example (VC++)