Creating system procedures

Many system procedures are explained in this manual, in the sections where they are relevant. For detailed reference information, see the Reference Manual: Procedures.

System administrators can write system procedures that can be executed in any database. Create a stored procedure in sybsystemprocs and assign it a name that begins with “sp_”. The uid of the stored procedure must be 1, the uid of the database owner.

Most system procedures that you create query the system tables. Sybase recommends that you do not create stored procedures that modify the system tables.

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 on can always update system tables, even when allow updates to system tables is turned off. To create a stored procedure that updates the system tables:

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

  2. Use create procedure to create the stored procedure.

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

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