SQL Server - an Error Occurred While Executing Batch. Error Message Is: the Directory Name Is Invalid

error when running any query in sql server management studio: the file exists

I've been struggling with this one for while and when I recently installed Toad for MySQL I got the same issue.

I installed sysInternals process monitor tool to try and work out which file was causing the issue.

The answer is temp files.

Both SQL server management studio and toad use a similar naming convention for their temp files. Both use the temp directory under your user account in Documents and Settings. In my case, there were over 60 thousand *.tmp files in that directory.

Watching the query execute through process monitor I could see the SQL IDE continually trying and failing to identify a temp file name which didn't exist until it finally gives up with a "The file exists" error.

The solution is simply to clear out the *.tmp files in your local settings temp directory.

Both SQL Management Studio and Toad for MySQL are now working fine on my machine.

Hope this helps.

SQL Server 2008: Error creating window handle

Handles are Windows tools to manage OS resources. When some app on your machine have memory leaks - you can run out of handles and this error occurs. Current state of handles can be seen in Task Manager (Handle Count)

As said in comments - it's a client side issue. For example large resultsets/query output to grid may end up to this error.

Solution: Reboot your PC, minimize the output of query. Also you can try to launch script via SQLCMD.

You can read more about it here.

Some explanation here.

Error While creating Store Procedures in Sql Server in C#

You are missing:

cmd.CommandType = CommandType.StoredProcedure;

Create and run your stored procedure including the field names against your database for example:

   USE Sample
CREATE Procedure [dbo].[SP_empInsert]
(@empCode VARCHAR(50),
@empName VARCHAR(50),
@empCellNum VARCHAR(50),
@empAddress VARCHAR(50),
@empdate VARCHAR(50))
AS
INSERT INTO Employee (EmpCode, EmpName, EmpCellNum, EmpAddress, EmpDate)
VALUES (@empCode,@empName,@empCellNum,@empAddress,@empdate)

Make sure the Stored Procedure is created in the Database in SQLServer:

Sample Image

Restore DB — Error RESTORE HEADERONLY is terminating abnormally.

You can check out this blog post. It had solved my problem.

http://dotnetguts.blogspot.com/2010/06/restore-failed-for-server-restore.html

Select @@Version

It had given me following output Microsoft SQL Server
2005 - 9.00.4053.00 (Intel X86) May 26 2009 14:24:20 Copyright (c)
1988-2005 Microsoft Corporation Express Edition on Windows NT 6.0
(Build 6002: Service Pack 2)

You will need to re-install to a new named instance to ensure that you are using the new SQL Server version.



Related Topics



Leave a reply



Submit