Chapter 5 Building Triggers and Procedures


Creating a message table

You create a message table which stores error message information.

Steps To create a message table:

  1. Create a table with columns to store the following information:
    Column to store... Description
    Error number Number of the error message that is referenced in the trigger script
    Message text Text of message
  2. Generate the table in your database.
  3. Select Database→Execute SQL.

    A dialog box asks you to identify a data source and connection parameters.
  4. Select a data source and fill in connection parameters.
  5. Click Connect.

    An SQL query editor box appears.
  6. Type an SQL statement to insert a message number and text in the appropriate columns. You can use the following format for example:

    insert into table values (error number,'error message' )

    insert into ERR_MSG values (1004,'The value that you are trying to insert does not exist in the referenced table' )
  7. Click Execute.

    A message box tells you that the command has been successfully executed.
  8. Click OK.

    You return to the SQL query box.
  9. Click Close.

 


Copyright (C) 2005. Sybase Inc. All rights reserved.