T-SQL script to extract date from string and delete
Posted on 2013-11-11
I have a column in database for 'FileName'. Possible file names in this column are as below;
FileXX (includes XX_2010_1_28_TO_2010_2_17.xml)
XSDSX (includes ZZZZZ_2013_1_1_TO_2013_10_9-3.xml)
I have to delete all records which have Bold date before 9th October 2013.
For text string with TO, date part after TO is to be considered
For text string with TO, but have a dash, the numeric value after dash can be ignored
For text string with single date, the date part has to be considered
How can I proceed to build such script?