Creating system procedures

Many of the system procedures are explained in this manual, in the sections where they are relevant. For complete information about system procedures, see the Reference Manual.

System Administrators can write system procedures that can be executed in any database. Simply create a stored procedure in sybsystemprocs and give it a name that begins with “sp_”. The uid of the stored procedure must be 1, the uid of the Database Owner.

Most of the system procedures that you create query the system tables. You can also create stored procedures that modify the system tables, although this is not recommended.

To create a stored procedure that modifies system tables, a System Security Officer must first turn on the allow updates to system tables configuration parameter. Any stored procedure created while this parameter is set to “on” will always be able to update system tables, even when allow updates to system tables is set to “off.” To create a stored procedure that updates the system tables:

  1. Use sp_configure to set allow updates to system tables to “on.”

  2. Create the stored procedure with the create procedure command.

  3. Use sp_configure to set allow updates to system tables to “off.”

    WARNING! Use extreme caution when you modify system tables. Always test the procedures that modify system tables in development or test databases, not in your production database.