日期:2014-05-17 浏览次数:20629 次
IF OBJECT_ID('tempdb.dbo.#Ta') IS NOT NULL
DROP TABLE #Ta
CREATE TABLE #Ta(fNumber varchar(16))
INSERT INTO #Ta(fNumber)
SELECT 'DN' UNION ALL
SELECT 'DN.TS' UNION ALL
SELECT 'DN.BJB' UNION ALL
SELECT 'DN.TS.ZJ' UNION ALL
SELECT 'DN.TS.ZJ.ZB'
select *,(select COUNT(*)+1 from master..spt_values
WHERE type='P'
and SUBSTRING(fNumber,number,1)='.')
from #ta a
IF OBJECT_ID('tempdb.dbo.#Ta') IS NOT NULL
DROP TABLE #Ta
CREATE TABLE #Ta(fNumber varchar(16))
INSERT INTO #Ta(fNumber)
SELECT 'DN' UNION ALL
SELECT 'DN.TS' UNION ALL
SELECT 'DN.BJB' UNION ALL
SELECT 'DN.TS.ZJ' UNION ALL
SELECT 'DN.TS.ZJ.ZB'
select *,(select COUNT(*)+1 from master..spt_values
WHERE type='P' and LEN(a.fNumber)>=number
and SUBSTRING(fNumber,number,1)='.')
from #ta a
IF OBJECT_ID('tempdb.dbo.#Ta') IS NOT NULL
DROP TABLE #Ta
CREATE TABLE #Ta(fNumber varchar(16))
INSERT INTO #Ta(fNumber)
SELECT 'DN' UNION ALL
SELECT 'DN.TS' UNION ALL
SELECT 'DN.BJB' UNION ALL
SELECT 'DN.TS.ZJ' UNION ALL
SELECT 'DN.TS.ZJ.ZB'
ALTER TABLE #Ta ADD fLevel int
UPDATE #Ta
SET fLevel = LEN(fNumber)