홈 · 개발 참고자료

개발 참고자료

[MS-SQL] 프로시져를 이용한 DW쿼리 조회

작성자
관리자
작성일
2017-04-10
조회
7397
분류
기타 DBMS
create procedure [dbo].[qp_use_good]
@qa_id char(6)
as begin
select distinct '[qt_101] 콘테이너Lot' q_table into #qp_use_good1 from qt_101 a where a.q_good = @qa_id
insert into #qp_use_good1
select distinct '[qt_411] 자재청구' q_table from qt_411 a where a.q_good = @qa_id
insert into #qp_use_good1
select distinct '[qt_431] 구매결의' q_table from qt_431 a where a.q_good = @qa_id
insert into #qp_use_good1
select distinct '[qt_500] 기초재고' q_table from qt_500 a where a.q_good = @qa_id
insert into #qp_use_good1
select distinct '[qt_511] 출고결의' q_table from qt_511 a where a.q_good = @qa_id
insert into #qp_use_good1
select distinct '[qt_521] 입고결의' q_table from qt_521 a where a.q_good = @qa_id
insert into #qp_use_good1
select distinct '[qt_531] 매각/멸실결의' q_table from qt_531 a where a.q_good = @qa_id
insert into #qp_use_good1
select distinct '[qt_551] 코드변환' q_table from qt_551 a where a.q_good = @qa_id or a.q_ogood = @qa_id
insert into #qp_use_good1
select distinct '[qt_591] 비용등록' q_table from qt_591 a where a.q_good = @qa_id
insert into #qp_use_good1
select distinct '[qt_593] 임차임대' q_table from qt_593 a where a.q_good = @qa_id
insert into #qp_use_good1
select distinct '[qt_600] 현장수불' q_table from qt_600 a where a.q_good = @qa_id
insert into #qp_use_good1
select distinct '[qt_695] 단가연결' q_table from qt_695 a where a.q_good = @qa_id

select * from #qp_use_good1
end
return
-- execute qp_use_good '000000'


GO