Cool Tips‎ > ‎

File System






Create Folder from TSQL

Originally part of a dynamic DB backup solution, this illustrates how to check for existence and create a subfolder structure from TSQL. 

2000, 2005, 2008, 2008R2, 2012


Check if File Exists from TSQL

Uses the extended procedure xp_fileexists to check whether a file exists from TSQL. 

2000, 2005, 2008, 2008R2, 2012 


Delete Files Older Than...

Not TSQL, but a batch file that can be invoked from a SQLAgent job.  Does not use xp_cmdshell.

2000, 2005, 2008, 2008R2, 2012