magritton
10/15/2015 - 12:34 PM

SQL example of substring and charindex to remove unwanted portions of a string in a table field

SQL example of substring and charindex to remove unwanted portions of a string in a table field

SELECT TOP 10000
	SUBSTRING(acd.OrigFileName, 0, CHARINDEX(',', acd.OrigFileName)),
	acd.OrigFileName
FROM APP_CSV_Data acd
WHERE acd.DateAdded >= '10.1.2015'
AND acd.OrigFileName LIKE '%,%'
ORDER BY acd.DateAdded