Problem running sql trace in the background

  • All,

    I have created a trace for the activity of a database and saved it to the following area on the Server C:\temp\CheckDBActivity.trc.

    I stopped the trace and scripted the trace for SQL 2000 to a file name C:\temp\CheckdatabaseActivity.sql.  Close down profiler.

    I finally opened the C:\temp\CheckdatabaseActivity.sql script via Query Analyser and enter the name C:\temp\CheckDBActivity in the InsertFilenameHere part of the script.

    When I run the script via QA I get errorcode 14.

    I then deleted the C:\temp\CheckDBActivity.trc before attempting to run the script again via QA but still get error code 14?

    Can anyone tell me where I am going wrong?

    Any help would be appreciated

    Regards

    Carl

  • I had a quick look on BOL for the sp_trace_create command and saw that error code 14 was due to an 'Invalid stop time. Returned when the stop time specified has already happened.' 

    I am puzzled by this because the stop time specified is in the future?  I read further that if you set the stop time = NULL then the trace will run until it is manually stopped or until the server is stopped and started.

    I set the @DateTime variable in the script to NULL and it is now running, defeating the object of setting a stop time?

    I also ran a getdate() to ensure the database datetime wasn't different to the format of the stop time.

    Any suggestions would be appreciated.

    Regards

    Carl

     

     

  • I have found a solution although I am not entirely happy.

    When the sql script is created the date is of the format yyyy-mm-dd (2005-11-02) so I have to set dateformat to ymd at the top of the script. 

    Regards

     

    Carl

  • Hey Carl - sounds like a good solution to me dude.

    Phil

  • Hello Phil.

     

    How are you doing?

    Spotted you where browsing this forum.

     

    Carl

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply