/****** Script for SelectTopNRows command from SSMS ******/ SELECT [ID] ,[Region_code] ,[Region_name] ,[Region_ParentID] ,[Region_level] ,[Region_order] ,[Region_name_en] ,[Region_shortname_en] FROM [DYBBERPDB].[dbo].[tb_ErpRegion] --递归调用写法 WITH r AS( SELECT * FROM [tb_ErpRegion] WHERE id = 1 union ALL SELECT [tb_ErpRegion].* FROM [tb_ErpRegion], r WHERE [tb_ErpRegion].[Region_ParentID] = r.id ) SELECT * FROM r ORDER BY id;