Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

Simple as that. No logout/login required.


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

I had similar problem on SQL Server 2012. I checked the folder value in %TEMP% variable (echo %TEMP% from command prompt ) and noticed that the folder did not exist. I created the folder and it did the trick!


I had this issue on my webserver (windows server r2 running SQL Server 2012)

The directory name is invalid.
(mscore lib)

Logging out (killing my remote session) and logging back in fixed the issue for me.