Need help on delete script | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Need help on delete script

I got a great script from ‘Ramblings of a DBA’ but I need it tweaked so it only deletes TRN files. I don’t know how to do this and was hoping someone in here did. Here is the code: — Delete all rows from the temp table except the ones that correspond to the files to be deleted DELETE FROM #DeleteOldFiles WHERE ISDATE(SUBSTRING(DirInfo, 1, 10)) = 0 OR DirInfo LIKE ‘%<DIR>%’ OR SUBSTRING(DirInfo, 1, 10) >= GETDATE() – @Retention
I need this to also say something like: or SUBSTRING(DirInfo, ?, ??) <> ‘TRN’ Thank

OR UPPER(SUBSTRING(DirInfo, LEN(DirInfo)-2, 3)) <> ‘TRN’