【发布时间】:2016-09-26 22:02:43
【问题描述】:
我有一个字符串com.test.edu.personal.SomeException: this is some error: test message。我需要将字符串作为SomeException: this is some error。
我的代码有问题:
declare @col varchar(100)
set @col = 'com.test.edu.personal.SomeException: this is some error: test message'
SELECT
SUBSTRING(@col,
LEN(@col) - CHARINDEX(':', @col) - CHARINDEX(':', REVERSE(@col)),
LEN(@col) - LEN(LEFT(@col, CHARINDEX ('.', @col))) - LEN(RIGHT(@col, LEN(@col) - CHARINDEX (':', @col))));
我收到nal.SomeException: this is some - 我在这里遗漏了一些东西
【问题讨论】:
-
定义该特定子字符串的规则是什么?
标签: sql sql-server substring