Does this folder exist?
Today I tripped over a problem that was new to me. I wanted to find out, in SQL, whether a folder existed in the file system. I knew about using xp_fileexist to check for existence of a file but what about a folder? Well, it doesn't work on a folder name and there's no sign of xp_folderexist. I finally found in a forum that you use xp_fileexist and pass in the imaginary file nul in that folder (eg. to check if the folder 'C:\test' exists, check if file 'C:\test\nul' exists). There was no explanation but, according to Raymond Chen who knows a few things, NUL is a special, 'magic' file name that goes back to DOS 1.0. So some days you learn an old new thing.