Search code examples
sqlsql-servertrace

SQL Server : Trace won't create file


I'm trying to start using SQL Trace and I am running into "Access Denied" errors when using the following:

exec @rc = sp_trace_create @TraceID output, 0, N'C:\Users\USER$\Desktop\SQLTrace', @maxfilesize, NULL 

if (@rc != 0) goto error

I have tried UNC path and local, I am using an admin account to login to Mgmt Studio, what component am I missing? I have tried saving locally and to a remote client.


Solution

  • It appears for whatever reason I had to point the location to here for it to work:

    C:\Users\Public\Desktop

    Regardless of which account I used for SSMS... Definitely permission related, but as I am Admin for windows and SQL not sure where root cause lies..