If your'e trying to select the filename from a full file path, this works in MS SQL:
SELECT RIGHT(batch_ID ,CHARINDEX('\',REVERSE(batch_ID ))-1)
An Aggregate function like MAX() can't be used in the context you were wanting, because it is designed to return a value from a series of rows.
To break it down:
REVERSE('C:\Users\xyz122\Desktop\PF\import\12-13\COMRECOP.xml')
Gets you: LMX.POCERMOC\31-21\tropmi\FP\potkseD\221zyx\sresU\:C
Then CHARINDEX finds the \ in the 13th position of the reversed string.
Telling you that you want the last 13 characters of the string, which we get with RIGHT(), but that includes the '\', so we subtract 1 from the 13 to get just the filename.