x

Unable to create procedure..too many arguments specified..HELP

I have been trying to create the procedure below but every time I get the following error:

Server: Msg 8144, Level 16, State 4, Procedure sp_trace_create, Line 9 Procedure or function sp_trace_create has too many arguments specified.

If I remove the "@filecount" variable, it runs fine!

How can I get this to work with "@filecount"???

 -- Create a Queue
 declare @rc int
 declare @TraceID int
 declare @maxfilesize bigint
 declare @filecount int
 set @maxfilesize = 2
 set @filecount = 5
 
 exec @rc = sp_trace_create @TraceID output, 2, N'D:\SQLTrace\trace_new', @maxfilesize, Null, @filecount
 if (@rc != 0) goto error
 
 -- Set the events
 declare @on bit
 set @on = 1
 exec sp_trace_setevent @TraceID, 10, 1, @on
 exec sp_trace_setevent @TraceID, 10, 6, @on
 exec sp_trace_setevent @TraceID, 10, 9, @on
 exec sp_trace_setevent @TraceID, 10, 10, @on
 exec sp_trace_setevent @TraceID, 10, 11, @on
 exec sp_trace_setevent @TraceID, 10, 12, @on
 exec sp_trace_setevent @TraceID, 10, 13, @on
 exec sp_trace_setevent @TraceID, 10, 14, @on
 exec sp_trace_setevent @TraceID, 10, 16, @on
 exec sp_trace_setevent @TraceID, 10, 17, @on
 exec sp_trace_setevent @TraceID, 10, 18, @on
 exec sp_trace_setevent @TraceID, 12, 1, @on
 exec sp_trace_setevent @TraceID, 12, 6, @on
 exec sp_trace_setevent @TraceID, 12, 9, @on
 exec sp_trace_setevent @TraceID, 12, 10, @on
 exec sp_trace_setevent @TraceID, 12, 11, @on
 exec sp_trace_setevent @TraceID, 12, 12, @on
 exec sp_trace_setevent @TraceID, 12, 13, @on
 exec sp_trace_setevent @TraceID, 12, 14, @on
 exec sp_trace_setevent @TraceID, 12, 16, @on
 exec sp_trace_setevent @TraceID, 12, 17, @on
 exec sp_trace_setevent @TraceID, 12, 18, @on
 exec sp_trace_setevent @TraceID, 14, 1, @on
 exec sp_trace_setevent @TraceID, 14, 6, @on
 exec sp_trace_setevent @TraceID, 14, 9, @on
 exec sp_trace_setevent @TraceID, 14, 10, @on
 exec sp_trace_setevent @TraceID, 14, 11, @on
 exec sp_trace_setevent @TraceID, 14, 12, @on
 exec sp_trace_setevent @TraceID, 14, 13, @on
 exec sp_trace_setevent @TraceID, 14, 14, @on
 exec sp_trace_setevent @TraceID, 14, 16, @on
 exec sp_trace_setevent @TraceID, 14, 17, @on
 exec sp_trace_setevent @TraceID, 14, 18, @on
 exec sp_trace_setevent @TraceID, 15, 1, @on
 exec sp_trace_setevent @TraceID, 15, 6, @on
 exec sp_trace_setevent @TraceID, 15, 9, @on
 exec sp_trace_setevent @TraceID, 15, 10, @on
 exec sp_trace_setevent @TraceID, 15, 11, @on
 exec sp_trace_setevent @TraceID, 15, 12, @on
 exec sp_trace_setevent @TraceID, 15, 13, @on
 exec sp_trace_setevent @TraceID, 15, 14, @on
 exec sp_trace_setevent @TraceID, 15, 16, @on
 exec sp_trace_setevent @TraceID, 15, 17, @on
 exec sp_trace_setevent @TraceID, 15, 18, @on
 exec sp_trace_setevent @TraceID, 17, 1, @on
 exec sp_trace_setevent @TraceID, 17, 6, @on
 exec sp_trace_setevent @TraceID, 17, 9, @on
 exec sp_trace_setevent @TraceID, 17, 10, @on
 exec sp_trace_setevent @TraceID, 17, 11, @on
 exec sp_trace_setevent @TraceID, 17, 12, @on
 exec sp_trace_setevent @TraceID, 17, 13, @on
 exec sp_trace_setevent @TraceID, 17, 14, @on
 exec sp_trace_setevent @TraceID, 17, 16, @on
 exec sp_trace_setevent @TraceID, 17, 17, @on
 exec sp_trace_setevent @TraceID, 17, 18, @on
 
 
 -- Set the Filters
 declare @intfilter int
 declare @bigintfilter bigint
 
 exec sp_trace_setfilter @TraceID, 10, 0, 7, N'SQL Profiler'
 
 
 -- Set the trace status to start
 exec sp_trace_setstatus @TraceID, 1
 
 -- display trace id for future references
 select TraceID=@TraceID
 goto finish
 
 error: 
 select ErrorCode=@rc
 
 finish: 
 go
more ▼

asked Jan 26, 2016 at 02:57 PM in Default

avatar image

boonazrah
1 2

What version of SQL Server are you using? I was able to run your code on a SQL 2014 instance without error.

Jan 26, 2016 at 05:01 PM JohnM

Hi there,

I am embarrassed to say it but I am using SQL 2000. This the only system in my environment running MSSQL 2000. we are in the process og migrating it to SQL 2012. But until that happens, I need to get this working. I can understand if you were not able to support me on this since this version has been retired along time ago.

I already have a workaround plan, which is a bit lengthy, for this issue but I thought I would try my luck doing it a much easier way.

Jan 27, 2016 at 07:06 AM boonazrah
(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

In SQL Server 2000, the @filecount parameter was not implemented yet. As far as I understand, that means you'll have to manually manage the number of rollover files created, to avoid eating all the disk.

more ▼

answered Jan 27, 2016 at 08:10 AM

avatar image

Magnus Ahlkvist
21.8k 20 41 42

Hi Magnus,

I think you are right. After doing some search, I found out that the @filecount variable was only introduced in SQL 2005. I guess I will have to manually managed the files till we finish migrate to SQL 2012. Thanks for your help.

Jan 27, 2016 at 08:28 AM boonazrah
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x33
x31
x16
x4

asked: Jan 26, 2016 at 02:57 PM

Seen: 151 times

Last Updated: Jan 27, 2016 at 08:28 AM

Copyright 2016 Redgate Software. Privacy Policy