Tuesday, January 18, 2011

SQL Server 2008 Job "Syntax Error"

I was attempting to create a job in SQL Server 2008 Management Studio that simply performs a SELECT on a table and emails the results.  It worked fine in Pre-Production, but in the Production environment, I got this strange error in the Job History Log:

The job failed.  The Job was invoked by User ....  The last step to run was step 1 (...).
  Unable to start execution of step 1 (reason: line(1): Syntax error). The step failed.

This was NOT a syntax error with my T-SQL statement, but rather this refers to the SQL statement that invokes the job.  These are the steps I had to take to fix the problem:


  1. Navigate to SQL Server Agent -> Jobs -> [Job Name] -> Properties -> Steps -> [Step that is causing troubles] -> Edit -> General -> General -> Package
  2. Add a backslash (\) to the front of the package.  (For example, change "Maintenance Plans\GroupRequestQueue" to "\Maintenance Plans\GroupRequestQueue".)
  3. Hit "Ok" twice, and try running the Maintenance Plan again.

1 comment:

  1. Unfortunately, this setting seems to get overwritten every time I save the maintenance plan. There may be a better way to solve this problem permanently, but this is the best I got for now.

    ReplyDelete