标签:
1 DECLARE @Name NVARCHAR (50) 2 SET @Name = ‘\EXAM\061023478874‘ 3 4 DECLARE @Position INT 5 6 --sql first indexof 7 SET @Position = CHARINDEX(‘.‘, @Name); 8 SELECT SUBSTRING (@Name, @Position+1,LEN(@Name)-@Position) 9 10 --sql last indexof 11 SET @Position = LEN(@Name) - CHARINDEX(‘\‘, REVERSE(@Name)) + 1 12 SELECT SUBSTRING (@Name, @Position+1,LEN(@Name)-@Position)
标签:
原文地址:http://www.cnblogs.com/binlyzhuo/p/5015406.html