sp_trace_generateevent

Transact-SQL Reference

Transact-SQL Reference

sp_trace_generateevent

Creates a user-defined event.

Syntax

sp_trace_generateevent [ @eventid = ] event_id
    [ , [ @userinfo = ] 'user_info' ]
    [ , [ @userdata = ] user_data ]

Arguments

[ @eventid = ] event_id

Is the ID of the event to turn on. event_id is int, with no default. The ID must be one of the event numbers from 82 through 91, which represent user-defined events as set with sp_trace_setevent.

[ @userinfo = ] 'user_info'

Is the optional user-defined string identifying the reason for the event. user_info is nvarchar(128), with a default of NULL.

[ @userdata = ] user_data

Is the optional user-specified data for the event. user_data is varbinary(8000), with a default of NULL.

Return Code Values

This table describes the code values that users may get following completion of the stored procedure.

Return code Description
0 No error.
1 Unknown error.
3 The specified Event is not valid. The Event may not exist or it is not an appropriate one for the store procedure.
13 Out of memory. Returned when there is not enough memory to perform the specified action.

Remarks

sp_trace_generateevent is a Microsoft SQL Server 2000 stored procedure that performs many of the actions previously executed by xp_trace_* extended stored procedures available in earlier versions of SQL Server. Use sp_trace_generateevent instead of xp_trace_generate_event.

Only ID numbers of user-defined events may be used with sp_trace_generateevent. SQL Server will raise an error if other event ID numbers are used.

Parameters of all SQL Trace stored procedures (sp_trace_xx) are strictly typed. If these parameters are not called with the correct input parameter data types, as specified in the argument description, the stored procedure will return an error.

Permissions

Only members of the sysadmin fixed server role can execute sp_trace_generateevent.

Examples

See Also

fn_trace_geteventinfo

sp_trace_setevent