sp_GetSQLStatements

Advantage SQL Engine

Returns a result set containing all active queries.

Syntax

sp_GetSQLStatements ()

Parameters

None.

Output

The sp_GetSQLStatements procedure will return a result set containing all queries that are open or active on the server. The result set has the following structure.

Field Name

Field Type

Field Size

Description

Query Number

Integer

4

A unique identifier for the query.

Active

Logical

1

True if the server is actively processing the statement.

Percent Complete

Double

8

The estimated percentage of the query that has been completed.

Connection Name

Character

100

Name of the computer executing the query.

Database User

Character

100

Name of the database user executing the query.

Database

Character

255

Name of the database the user is connected to.

Query

Memo

9

The current SQL statement that is being executed.

Is Script

Logical

1

If more than one SQL statement is being processed in the current request.

Full Script

Memo

9

The complete SQL script sent to the server. This field will be NULL if only a single query is being executed.

Start Time

Time

4

Time on the server when the query was started.

Seconds Until Finished

Integer

4

Estimated number of seconds until the query is finished executing.

See Also

sp_CancelQuery