0

I have run the bcp command in query window to generate the tsv file. In between I cancelled the query. I tried to kill the SPID. But it is killed/rollback.

I tried to delete the tsv file in server. It is throwing error as 'the file cant be deleted because it is open in bcp.exe'. please assist to resolve

1

The easiest way is to restart the machine however that can't be recommended since it is a server and not PC. I would suggest to find the process in the task manager in the process tab and look for anything starting with or similar to BCP and you can do "End Process" or if that doesn't work then "End Process Tree". Once you killed this process, file would be released and will be ready for any I/O operation.

Please let us know in case this helps.

  • Thanks for your suggest. Instead of restart the server ,I tried to end the bcp.exe process in task manager. This exe will not show if the script executed from other system. need to select 'Show processed from all users'.Issue has resolved now. – user2741663 Jun 6 '18 at 7:01
  • Yes, absolutely agree with you. If bcp was not run using your account and you still want to kill that means - you are admin on the server and definitely can see process from all users. Glad to see that issue you were facing is resolved. – Learning_DBAdmin Jun 6 '18 at 7:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.