System Procedures

System administrators can create new system procedures in the sybsystemprocs database.

System procedure names must begin with the characters “sp_”. You can execute these procedures from any database by specifying the procedure name; you need not qualify it with the sybsystemprocs database name. For more information about creating system procedures, see the System Administration Guide.

System procedure results may vary, depending on the context in which they are executed. For example, sp_foo, which executes the db_name () system function, returns the name of the database from which it is executed. When executed from the pubs2 database, it returns the value “pubs2”:
use pubs2
sp_foo
------------------------------ 
pubs2 
When executed from sybsystemprocs, it returns the value “sybsystemprocs”:
use sybsystemprocs
sp_foo
------------------------------ 
sybsystemprocs