|
Sybernet / Supplied Packages Reference
Release 3.00 Dec 04, 2005 |
|
This procedure provides information about your process. With it you can retrieve your fully qualified name, registered title, group name, and the version of your stored procedure. This "package" requires that you pass @@procid which must be saved as a local variable.
The most useful output parameter in this package is your name. Your stored procedure probably refers to its name in several places. If you change the name of your procedure, then all references must also be changed. If you instead reference this name dynamically, then only the name in the procedure heading needs to be changed.
If your procedure can be invoked by Sybercron, you should reference sp_myself.username instead of suser_name() if security is important. sp_myself.username returns suser_name() if your procedure is not invoked by Sybercron or the suser_name() of the invoker if invoked by Sybercron. In other words, using suser_name() is unsafe. sp_myself.username is always safe.
procedure sp_myself
(
@PROCID INT
, @NAME VARCHAR(92) = NULL OUT
, @VERSION VARCHAR(30) = NULL OUT
, @PATCH_NUMBER CHAR(3) = NULL OUT
, @PATCH_DATE CHAR(10) = NULL OUT
, @PATCH_DESCRIPTION VARCHAR(255) = NULL OUT
, @TITLE VARCHAR(92) = NULL OUT
, @DESCRIPTION VARCHAR(255) = NULL OUT
, @GROUPNAME VARCHAR(92) = NULL OUT
, @GROUPTYPE VARCHAR(9) = NULL OUT
, @DEVELOPER VARCHAR(11) = NULL OUT
, @CUSTODIAN VARCHAR(11) = NULL OUT
, @CUSTOMER VARCHAR(11) = NULL OUT
, @USERNAME VARCHAR(30) = NULL OUT
, @MAILTO VARCHAR(255) = NULL OUT
, @MAILCC VARCHAR(255) = NULL OUT
, @MAILBCC VARCHAR(255) = NULL OUT
, @MAILFROM VARCHAR(255) = NULL OUT
, @CONTENTTYPE VARCHAR(30 = NULL OUT
, @DISPOSITION VARCHAR(30) = NULL OUT
, @DATENAME VARCHAR(30) = NULL OUT
, @SCRIPTNAME VARCHAR(255) = NULL OUT
)
| Name | Description |
|---|---|
procid |
The value of @@procid in your running procedure. |
name |
The fully qualified name of your stored procedure. This name is unqualified if it resides in sybsystemprocs. |
version |
The version number of your stored procedure. This value is retrieved from syscomments and must follow the convention for Sybernet stored procedures. |
patch_number |
The latest patch number of your stored procedure. |
patch_date |
The date of the last patch made to this procedure. |
patch_description |
The description of the last patch made to this procedure. |
title |
The description of this stored procedure from the Sybernet register. |
description |
The long description of this stored procedure from the Sybernet register. |
groupname |
The name of the stored procedure that represents the parent of this stored procedure. |
grouptype |
The type of this registered procedure. |
developer |
The employee number of the developer. |
custodian |
The employee number of the custodian. |
customer |
The employee number of the customer. |
username |
suser_name() of the invoker of this procedure. |
mailto |
The e-mail address of the invoker or the e-mail address of this Sybercron process. |
mailto |
Null if not invoked by Sybercron. |
mailcc |
Null if not invoked by Sybercron. |
mailbcc |
Null if not invoked by Sybercron. |
contenttype |
Null if not invoked by Sybercron. |
disposition |
Null if not invoked by Sybercron. |
datename |
Null if not invoked by Sybercron. |
scriptname |
Null if not invoked by Sybercron. |
The following example illustrates how to call sp_myself:
DECLARE
@PROCID INT
, @NAME VARCHAR(92)
, @VERSION VARCHAR(30)
, @PATCH_NUMBER CHAR(3)
, @PATCH_DATE CHAR(10)
, @PATCH_DESCRIPTION VARCHAR(255)
, @TITLE VARCHAR(92)
, @DESCRIPTION VARCHAR(255)
, @GROUPNAME VARCHAR(92)
, @GROUPTYPE VARCHAR(9)
, @DEVELOPER VARCHAR(11)
, @CUSTODIAN VARCHAR(11)
, @CUSTOMER VARCHAR(11)
, @USERNAME VARCHAR(30)
, @MAILTO VARCHAR(255)
, @MAILCC VARCHAR(255)
, @MAILBCC VARCHAR(255)
, @MAILFROM VARCHAR(255)
, @CONTENTTYPE VARCHAR(30)
, @DISPOSITION VARCHAR(30)
, @DATENAME VARCHAR(30)
, @SCRIPTNAME VARCHAR(255)
BEGIN
SELECT @PROCID = @@PROCID
EXEC sp_myself
@PROCID = @PROCID
, @NAME = @NAME OUTPUT
, @VERSION = @VERSION OUTPUT
, @PATCH_NUMBER = @PATCH_NUMBER OUTPUT
, @PATCH_DATE = @PATCH_DATE OUTPUT
, @PATCH_DESCRIPTION = @PATCH_DESCRIPTION OUTPUT
, @TITLE = @TITLE OUTPUT
, @DESCRIPTION = @DESCRIPTION OUTPUT
, @GROUPNAME = @GROUPNAME OUTPUT
, @GROUPTYPE = @GROUPTYPE OUTPUT
, @DEVELOPER = @DEVELOPER OUTPUT
, @CUSTODIAN = @CUSTODIAN OUTPUT
, @CUSTOMER = @CUSTOMER OUTPUT
, @USERNAME = @USERNAME OUTPUT
, @MAILTO = @MAILTO OUTPUT
, @MAILCC = @MAILCC OUTPUT
, @MAILBCC = @MAILBCC OUTPUT
, @MAILFROM = @MAILFROM OUTPUT
, @CONTENTTYPE = @CONTENTTYPE OUTPUT
, @DISPOSITION = @DISPOSITION OUTPUT
, @DATENAME = @DATENAME OUTPUT
, @SCRIPTNAME = @SCRIPTNAME OUTPUT
END