Question

SQL Server - An error occurred while executing batch. Error message is: The directory name is invalid

Our database server had run out of disk space, after freeing up some disk space any query run in sql server management studio, with the results sent to grid view, resulted in this error:
An error occurred while executing batch. Error message is: The directory name is invalid.

When the results sent to text view the queries worked fine.

Does anyone know why this error occurs and how to get rid of it?

 45  94467  45
1 Jan 1970

Solution

 60

All you need to do is to open command prompt and type: mkdir %temp% and press Enter.

Simple as that. No logout/login required.

2017-03-14

Solution

 49

Received the message:

SQL Server - An error occurred while executing batch. Error message is: The directory name is invalid

When trying to execute a query in Management Studio after deleting temp files from c:\documents and settings\administrator\local settings\temp

Resolved when logging out of server session and back in again.

This resolution fixes this error on the following environments:

  • Windows Server 2003
  • Windows Server 2008
  • Windows Server 2012
  • Sql Server 2005
  • Sql Server 2008
  • Sql Server 2008 R2
  • Sql Server 2012
  • Sql Server 2014
  • Sql Server 2016
2012-08-01