Szerkesztés

Megosztás a következőn keresztül:


SP:Recompile Event Class

Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance

The SP:Recompile event class indicates that a stored procedure, trigger, or user-defined function has been recompiled. Recompilations reported by this event class occur at the statement level.

The preferred way to trace statement-level recompilations is to use the SQL:StmtRecompile event class. The SP:Recompile event class is deprecated. For more information, see SQL:StmtRecompile Event Class.

SP:Recompile Event Class Data Columns

Data column name Data type Description Column ID Filterable
ApplicationName nvarchar Name of the client application that created the connection to an instance of Microsoft SQL Server. This column is populated with the values passed by the application rather than the displayed name of the program. 10 Yes
ClientProcessID int ID assigned by the host computer to the process where the client application is running. This data column is populated if the client provides the process ID. 9 Yes
DatabaseID int ID of the database in which the stored procedure is running. Determine the value for a database by using the DB_ID function. 3 Yes
DatabaseName nvarchar Name of the database in which the stored procedure is running. 35 Yes
EventClass int Type of event = 37. 27 No
EventSequence int The sequence of a given event within the request. 51 No
EventSubClass int Type of event subclass. Indicates the reason for recompilation.

1 = Schema Changed

2 = Statistics Changed

3 = Recompile DNR

4 = Set Option Changed

5 = Temp Table Changed

6 = Remote Rowset Changed

7 = For Browse Perms Changed

8 = Query Notification Environment Changed

9 = MPI View Changed

10 = Cursor Options Changed

11 = With Recompile Option
21 Yes
GroupID int ID of the workload group where the SQL Trace event fires. 66 Yes
HostName nvarchar Name of the computer on which the client is running. This data column is populated if the client provides the host name. To determine the host name, use the HOST_NAME function. 8 Yes
IntegerData2 int Ending offset of the statement within the stored procedure or batch that caused recompilation. Ending offset is -1 if the statement is the last statement in its batch. 55 Yes
IsSystem int Indicates whether the event occurred on a system process or a user process. 1 = system, 0 = user. 60 Yes
LoginName nvarchar Name of the login of the user (either SQL Server security login or the Microsoft Windows login credentials in the form of DOMAIN\username). 11 Yes
LoginSid image Security identification number (SID) of the logged-in user. You can find this information in the sys.server_principals catalog view. Each SID is unique for each login in the server. 41 Yes
NestLevel int The nesting level of the stored procedure. 29 Yes
NTDomainName nvarchar Windows domain to which the user belongs. 7 Yes
NTUserName nvarchar Windows user name. 6 Yes
ObjectID int System-assigned ID of the stored procedure. 22 Yes
ObjectName nvarchar Name of the object that triggered the recompile. 34 Yes
ObjectType int Value that represents the type of object involved in the event. For more information, see ObjectType Trace Event Column. 28 Yes
Offset int Starting offset of the statement within the stored procedure or batch that caused recompilation. 61 Yes
RequestID int ID of the request containing the statement. 49 Yes
ServerName nvarchar Name of the instance of SQL Server being traced. 26 No
SessionLoginName nvarchar Login name of the user who originated the session. For example, if you connect to SQL Server using Login1 and execute a statement as Login2, SessionLoginName shows Login1 and LoginName shows Login2. This column displays both SQL Server and Windows logins. 64 Yes
SPID int ID of the session on which the event occurred. 12 Yes
SqlHandle varbinary 64-bit hash based on the text of an ad hoc query or the database and object ID of a SQL object. This value can be passed to sys.dm_exec_sql_text to retrieve the associated SQL text. 63 Yes
StartTime datetime Time at which the event started, if available. 14 Yes
TextData ntext Text of the Transact-SQL statement that caused a statement-level recompilation. 1 Yes
TransactionID bigint System-assigned ID of the transaction. 4 Yes
XactSequence bigint Token used to describe the current transaction. 50 Yes

See Also

sp_trace_setevent (Transact-SQL)
SQL:StmtRecompile Event Class