I must check if all files from C:\Import\*.doc were processed and imported in to a database Table Filename. If the Filename exists in the Table Filename then it can be deleted from the Folder C:\Import otherwise the file must remain in the folder. Can anyone Help me ?
Yes it can be done by T-SQL, but that doesn't mean that it should be. xp_fileexists is undocumented by Microsoft in Books Online. There are better ways of achieving what you want. Application code, Powershell, SSIS for instance.