1 USE [test] 2 GO 3 /****** Object: StoredProcedure [dbo].[p01_get_group_path] Script Date: 2019/7/8 14:40:47 ******/ 4 SET ANSI_NULLS ON 5 GO 6 SET QUOTED_IDENTIFIER ON 7 GO 8 ALTER PROC [dbo].[p01_get_group_path] 9 AS 10 --s1,獲取擔保圈路徑 11 IF OBJECT_ID(N'dbo.t01_get_group_path') IS NOT NULL 12 DROP TABLE dbo.t01_get_group_path; 13 14 SELECT t.full_path, 15 t.nlevel, 16 ROW_NUMBER() OVER (ORDER BY t.full_path) AS groupno 17 INTO dbo.t01_get_group_path 18 FROM 19 ( 20 SELECT DISTINCT 21 b.full_path, 22 b.nlevel 23 FROM [dbo].[dbgx] AS a 24 CROSS APPLY [dbo].[f_findrecycle](a.KHMC, 10) AS b 25 --WHERE a.KHMC IN ( '山東鄆城卡德維潤滑油有限公司', '鄆城惠達化纖製品有限公司', 26 -- '鄆城縣久隆塑料製品有限公司', '鄆城海鵬鞋業有限公司', '鄆城昌順機械有限公司', 27 -- '鄆城恩銀機械有限公司' ) 28 ) AS t;