USE [DLPtro]
GO
/****** Object: StoredProcedure [dbo].[Pr_Area_SelectByID] Script Date: 11/17/2013 20:23:10 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- 作者: test
-- 建立时间: 2200年3月5日 13点
-- 功能描述: 查询指定ID的地区信息
-- =============================================
ALTER PROCEDURE [dbo].[Pr_Area_SelectByID]
--参数
@ErrorCode int Output,
@Area_ID int
AS
BEGIN
--查询所有数据
SELECT
T.*,
TL.AreaLevel_Name,TAD.Area_Dir_Direction_ID, TD.Direction_Name
from B_Area AS T
Left Join B_AreaLevel as TL on T.Area_AreaLevel_ID = TL.AreaLevel_ID
Left join B_Area_Direction as TAD on T.Area_ID = TAD.Area_Dir_Area_ID
Left join B_Direction as TD on TAD.Area_Dir_Direction_ID = TD.Direction_ID
where T.Area_ID = @Area_ID and T.Area_State = 1 ORDER BY T.Area_ID ASC
select @ErrorCode=@@ERROR
END