I have N
number of tables in my database, which holds around 0.6 million records. I've created a SQL script which copies this data into same tables (basically it's a script to generate more data). I've tested the script it runs fine for small data (10k records). When I tried it to copy all data, it throws an error:
An error occurred while executing batch. Error message is: Error creating window handle.
1.What is the meaning of this error in SQL Server?
2.Does it has to do anything with my SQL in script, or is this cause of other component of SQL Server?
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.