A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  special characters  sybase-tech-blog


Category: ASE: Stored Procedures

User Defined Stored Procedure, User Defined Procedure

User defined stored procedures are stored procedures written by a user in contrast to system procedures which are created during server installation. User defined procedures are by default stored in the database in which the user is currently located. The procedure can be created using the create procedure command. The source code of the stored procedure can contain information, among others, on if, and which parameters have to be specified when executing the stored procedure

When executing a stored procedure, the procedure name hints ASE where to look for it. All procedures prefixed with  sp_  are searched in the current database, sybsystemprocs and master, in this order. Procedures created without this prefix, are expected to be stored exclusively in the user's current database (unless specified with a fully qualified name like "database..procedurename").

In practice it has proven value to create user defined stored procedures with a unique prefix (e.g.  mysp_ ). This way it can be avoided that users create stored procedures in their databases, having the same name as an already existing system stored procedure, thus avoiding confusion and misunderstandings.

Furthermore it is recommended to execute procedures by referencing their fully qualified name. For example:

sybsystemprocs..sp_who

See also:

System Procedures.