DECLARE @Name NVARCHAR (50)
SET @Name = ‘12345.67890ABCDE.FGHIJKLMNOPQRSTUVWXYZTest’
DECLARE @Position INT
–sql first indexof
SET @Position = CHARINDEX(‘.’, @Name);
SELECT SUBSTRING (@Name, @Position+1,LEN(@Name)-@Position)
–sql last indexof
SET @Position = LEN(@Name) – CHARINDEX(‘.’, REVERSE(@Name)) + 1
SELECT SUBSTRING (@Name, 0, @Position)
版权属于:
Elysian
作品采用:
《
署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)
》许可协议授权
评论