Returns the data in a COMPUTE clause column.
SqlAData$ ( sqlconn%, computeid%, column% )
where
A string containing the data in the compute column. For the SQL Server datatypes binary, varbinary, and image, SqlAData$ returns a string of binary data. For all other datatypes, SqlAData$ returns a string of characters. When there is no such column or when the data is NULL, an empty string is returned. To make sure that the data really is NULL, always check for a return of 0 by using SqlADLen&.
After each call to SqlNextRow% that returns a value greater than 0, use SqlAData$ to obtain the data in a particular COMPUTE clause column. The data is not null-terminated. Use SqlADLen& to get the length of the data in a COMPUTE clause column.
'Put commands into the command buffer. cmd$ = "SELECT db_name(dbid), dbid, size FROM sysusages" cmd$ = cmd$ " ORDER BY dbid" cmd$ = cmd$ " COMPUTE SUM(size) BY dbid" Result% = SqlCmd%(Sqlconn%, cmd$) 'Send commands to SQL Server and start execution. Result% = SqlExec%(Sqlconn%) Result% = SqlResults%(Sqlconn%) 'Examine the results of the COMPUTE clause. IF Result% = SUCCEED THEN DO UNTIL Result% = NOMOREROWS Result% = SqlNextRow%(Sqlconn%) IF Result% = NOMOREROWS THEN Exit DO IF Result = REGROW THEN PRINT "regular row returned." PRINT ELSE 'This row is the result of a COMPUTE clause 'and Result% is the computeid% of this 'COMPUTE clause sum = Val(SqlAData$(Sqlconn%, Result%, 1)) PRINT "sum = "; sum PRINT END IF LOOP
SqlADLen&, SqlAltLen%, SqlAltType%, SqlGetRow%, SqlNextRow%, SqlNumAlts%