 |
|
SQL Server Tips by Burleson |
Parameter Management
srv_rpcparams
This returns the number of parameters passed to your XP.
srv_paramname
This function is used to get the name of a parameter, which is
passed, by name. Parameters to an XP can be passed by name or by
position and you cannot mix the two at the same time. Passing a
parameter by name is useful, when your XP can be called with a lot
of parameters but most of the time default values can be used for
the less used ones. Normally when your XP has only a few parameters
you would pass then by position and would have no use for “srv_paramname”.
Parameter indexes start at 1 so your code should be careful when you
use C based indices which start at 0.
srv_paramnumber
This is the corollary to the function srv_parname. It returns the
index of a parameter given the parameter name. Again this function
is only useful if the XP will pass it parameters by name.
srv_paraminfo
This function returns information about a specific parameter.
Information returned includes its ODS data type, Maximum Length,
Actual Length, the data for the parameter and whether it is a null
flag.
srv_paramstatus
This function returns a value, which represents the “status” of a
parameter. Currently only one status flag is defined. This is
whether the parameter is a return parameter (i.e. defined in TSQL
using “OUTPUT”)
srv_paramsetoutput
This function allows the actual value of an OUTPUT parameter to be
set from your XP.
The above book excerpt is from:
Super SQL
Server Systems
Turbocharge Database Performance with C++ External Procedures
ISBN:
0-9761573-2-2
Joseph Gama, P. J. Naughter
http://www.rampant-books.com/book_2005_2_sql_server_external_procedures.htm |