How to get the latest MS SQL Server error message?

I know:

SELECT @@ERROR 

but this will only give me the ERROR CODE (number), and I need a full text message, for example:

Cannot insert duplicate key string into object 'dbo.TABLE_NAME' with unique index 'IX_ID_unique'.

The statement is complete.

How to do it in MS Sql Server 2005?

EDIT: I need to get this error message on Linux and Windows platforms.

+6
php sql-server
source share
2 answers

How about ERROR_MESSAGE

See also: Getting Error Information in Transact-SQL


And, with PHP (as your question is tagged php ), take a look at:

Depending on the API that you use to access the MS SQL Server database, of course.

+5
source share
0
source share

All Articles