I have a CLR stored procedure which exports a large table into a text file.
The procedure works fine but. When I manually stop its execution from SQL Management Studio I cannot delete the file it created ().
Error Deleting File or Folder Cannot delete XXXXXXXXXXX: It is being used by another person or program. Close any programs that might be using the file and try again.
I looked for a SQL process (with sp_who2 active
) and for a Windows process (with tasklist
) on the SQL Machine but I can't identify the process that keeps the file locked.
Please tell me how to kill the process (without restarting SQL server)