I've seen those error codes with prefix HY like HYT00 in MS-SQL or HY000 in MySQL, but, what do they stand for? why are they similar?


what do they stand for?

Codes like HYT00 and HY000 are called SQLSTATE. The HY part is the Class.

I can't find any documentation that even hints at what it stands for. There is nothing to indicate that the individual letters have any meaning. Most other classes are numeric (hex), ranging from 00 to 46. And then we have HV, HW, HY, and HZ. That would seem to rule out the theory that HY was chosen as a tribute to Henny Youngman. Rather, it looks like they reserved class codes with a first character of with I through Z for implementation-specific classes, and that left HZ as be the highest one defined in the ANSI spec. Then they worked backward through HY, HW, and HV for other conditions generally outside of SQL itself -- datalinks, foreign data wrappers, and call-level interfaces. (They skipped HX -- another mystery.)

why are they similar?

Because it is part of the ANSI SQL standard. Any RDBMS that wants to follow the standard will use the SQLSTATE format for their return codes.

According to this Teradata documentation, ANSI defines HY as a CLI condition.

Call-Level Interface condition

Note: The Call-Level Interface referred to is not the Teradata Database CLIv2, but rather an ANSI-standard CLI that is a dialect of the Microsoft Open Database Connectivity, or ODBC, specification.

IBM says:

'HY', is generated by the CLI or ODBC driver.

MariaDB says that HY

is the class used for builtin conditions which do not have a specific SQLSTATE class.

Firebird SQL uses HY for:

"CLI-specific Condition"

The MariaDB usage is an outlier, but the consensus is that HY is used for errors raised by the CLI. (Note that this does not stand for Command Line Interface, but rather for Call-Level Interface, which is the API for embedding SQL code in a host program. See https://en.wikipedia.org/wiki/Call_Level_Interface.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.