The SERVERMSG structure contains the following two key fields that should be processed by the application program:
SMSG_MSGNO – contains the error message number from SQL Server or MSG
SMSG_TEXT – contains the actual error message text
You can find the error message numbers and text returned from SQL Server by querying and/or printing the SQL Server SYSMESSAGES table, which contains copies of all the error messages that SQL Server returns.