Why does the order of parameters matter for sp_trace_create?
I believe this is because it is an extended stored procedure and the parameter names are actually entirely ignored. It just goes off position.
I have renamed them as below (and given them all the same name) and it still works fine.
DECLARE @new_trace_id INT;
EXECUTE master.dbo.sp_trace_create
@rubbish = @new_trace_id OUTPUT,
@rubbish = 0,
@rubbish = N'C:\temp\TestTrace';
SELECT @new_trace_id AS [@new_trace_id];
EXECUTE master.dbo.sp_trace_setstatus
@trace_id = @new_trace_id,
@status = 2;
A similar documentation bug was filed by Aaron about sp_executesql
.
Another annoying aspect of that stored procedure is that the @maxfilesize
must be passed as 'bigint' and it doesn't accept a literal integer. I assume that this is also because it is an extended stored procedure.