--求父级代码 SELECT SUBSTRING ('A.001.001.0001', 0,len('A.001.001.0001')-charindex('.',REVERSE('A.001.001.0001'))+1)
--REVERSE 是反转,charindex 是求出现的第一个位置
--求父级代码 SELECT SUBSTRING ('A.001.001.0001', 0,len('A.001.001.0001')-charindex('.',REVERSE('A.001.001.0001'))+1)
--REVERSE 是反转,charindex 是求出现的第一个位置
转载于:https://www.cnblogs.com/zhou90/p/9836848.html