You have an easy problem and a harder problem.
(您有一个简单的问题,一个较困难的问题。)
To get the records you want to join that start with DJ_...
(要获取要加入的记录,以DJ_开头...)
a simple where LEFT(string,3) = 'DJ_'
(一个简单的where LEFT(string,3) = 'DJ_'
)
Now getting the number out.
(现在获取号码。)
This one is fun...
(这个很有趣...)
substring(right('DJ_12_XYZ_1_YTR_12345.trt',charindex('_',reverse('DJ_12_XYZ_1_YTR_12345.trt'),1)),2,5)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…