SQL Text (PD_SQL)
- Organization of this page
Function
The SQL Text (PD_SQL) record indicates the execution information on the last query issued by a process. The number of records created equals the number of queries that the process last issued. This is a multi-instance record.
The SQL Plan and SQL Text fields of this record use a DBCC INPUTBUFFER statement for acquiring data. To execute this statement, you must have a fixed server role sysadmin member account for Microsoft SQL Server.
Because this record is available only in real-time, it cannot be displayed in the Properties window of Performance Reporter by clicking an Agent icon on the Agents window and then clicking the Properties method.
- Notes:
-
In a Simplified-Chinese Windows environment, when an SQL statement includes a non- GBK character, the value of the SQL Plan field cannot be collected correctly. Non- GBK characters appear as ? or other unreadable characters.
ODBC key field
PD_SQL_SPID
Lifetime
None
Record size
-
Fixed part: 681 bytes
-
Variable part: 30,464 bytes
Fields
View name (Manager name) |
Description |
Summary |
Format |
Delta |
Data source |
|
---|---|---|---|---|---|---|
SQL Server version 2014 or earlier |
SQL Server version 2016 or later |
|||||
Command (COMMAND) |
The last command executed |
-- |
string(33) |
No |
master..sysprocesses.cmd |
dm_exec_requests.Command |
Record Time (RECORD_TIME) |
Interval end time (GMT format) |
-- |
time_t |
No |
Agent Collector |
|
Record Type (INPUT_RECORD_TYPE) |
Record type (always SQL) |
-- |
char(8) |
No |
Agent Collector |
|
SID (SID) |
User's security ID |
-- |
string(171) |
No |
master..syslogins.sid |
sys.databases.owner_sid |
SPID (SPID) |
Process ID |
-- |
word |
No |
master..sysprocesses.spid |
sys.dm_exec_sessions.session_id |
SQL Plan (SQL_PLAN) |
Displays the execution information for an SQL statement. |
-- |
string(30001) |
No |
Result obtained when SET SHOWPLAN_ALL ON and SET NOEXECON are specified for executing the SQL Text statement |
|
SQL Text (SQL_TEXT) |
Displays the last statement sent by this process. |
-- |
string(30001) |
No |
DBCC INPUTBUFFER(master..sysprocesses.spid) |
DBCC INPUTBUFFER(sys.dm_exec_sessions.session_id) |
Start Time (START_TIME) |
Interval start time (GMT format) |
-- |
time_t |
No |
Agent Collector |
|
User (USER) |
Logon name of the user who issued the command |
-- |
string(257) |
No |
master..sysprocesses.loginame |
sys.dm_exec_sessions.login_name |