I am trying to extract data from table into a multiple text files using bcp utility. The problem is that bcp hung when it is sequentially executed in a loop (in real life example it is a fetch).
The final message is :
An error occurred while executing batch. Error message is: Exception of type 'System.OutOfMemoryException' was thrown.
During the query execution sometimes spatial result window will be briefly shown but I cannot switch to it.
The problem can be replicated using this simple example:
Would anyone know how can I make the above procedure work? It behaves the same on 2008, 2012 and SQL 2014.
Thanks in advance,