Extended Stored Procedure Programming

Extended Stored Procedure Programming


Returns the maximum data length of a remote stored procedure call parameter.

Important  This Open Data Services function or macro is only supported in Microsoft® SQL Server™ 2000 for backward compatibility. It has been superseded by the srv_paraminfo function.

For more information about Open Data Services functions or macros supported for backward compatibility, see Open Data Services (Level 3).


int srv_parammaxlen ( SRV_PROC * srvproc,
int n );



Is a pointer to the SRV_PROC structure that is the handle for a particular client connection (in this case, the handle that received the remote stored procedure call). The structure contains information the ODS Library uses to manage communication and data between the Open Data Services server application and the client.


Indicates the number of the parameter. The first parameter is 1.


The maximum length, in bytes, of the parameter data. If there is no nth parameter or if there is no remote stored procedure, returns -1.

This function returns the following values, if the parameter is one of the following SQL Server data types.

New data types Input data length
  NULL ZERO >=255 <255
BITN 1 1 N/A N/A
BIGVARCHAR 255 255 255 255
BIGCHAR 255 255 255 255
BIGBINARY 255 255 255 255
BIGVARBINARY 255 255 255 255
NCHAR 255 255 255 255
NVARCHAR 255 255 255 255
NTEXT -1 -1 -1 -1


Each remote stored procedure parameter has an actual and a maximum data length. For standard fixed-length data types that do not allow null values, the actual and maximum lengths are the same. For variable-length data types, the lengths can vary. For example, a parameter declared as varchar(30) can have data that is only 10 bytes long. The parameter's actual length is 10 and its maximum length is 30. The srv_parammaxlen function gets the maximum data length of a remote stored procedure. To obtain the actual length of a parameter, use srv_paramlen.

When a remote stored procedure call is made with parameters, the parameters can be passed either by name or by position (unnamed). If the remote stored procedure call is made with some parameters passed by name and some passed by position, an error occurs. The SRV_RPC handler is still called, but it appears as if there were no parameters, and srv_rpcparams returns 0.

See Also