SqlADLen&

Returns the length of the data in a compute column.

Syntax

SqlADLen& ( sqlconn%, computeid%, column% )

where

sqlconn%
Is a SQL Server connection. The value of sqlconn% is returned by SqlOpen%.
computeid%
Is the COMPUTE clause. A SELECT statement can have multiple COMPUTE clauses, which can have varying numbers of aggregate operators and aggregate targets. The computeid% is returned by SqlNextRow% or SqlGetRow%.
column%
Is the column number. The first column is number 1.

Returns

The length, in bytes, of the data in a compute column. When no such column or COMPUTE clause exists, -1 is returned. When the data has a null value, 0 is returned.

Remarks

Example

'Put the command into the command buffer.
cmd$ = "SELECT name FROM sysobjects"
cmd$ = cmd$  " ORDER BY name"
cmd$ = cmd$  " COMPUTE MAX(name)"

'Send the command to SQL Server and start execution.
Result% = SqlCmd%(Sqlconn%,cmd$)
Result% = SqlExec%(Sqlconn%)

'Process the results of each statement.
 DO UNTIL Result% = NOMOREROWS
   Result% = SqlNextRow%(Sqlconn%)
   IF Result% = NOMOREROWS THEN Exit DO
   ELSE IF Result = REGROW THEN
      PRINT "regular row returned."
      PRINT
   ELSE
      'This row is the result of a COMPUTE clause.
      DataLength& = SqlADLen&(Sqlconn%, ComputeID%, 1)
      Data$ = SqlAData$(Sqlconn%, ComputeID%, 1)
      PRINT "The length of "  Data$  " is "  DataLength&  "bytes."
   END IF LOOP       

See Also

SqlAData$, SqlAltLen%, SqlAltType%, SqlGetRow%, SqlNextRow%, SqlNumAlts%