데이터베이스 개발자 질문과 답변 게시판
데이터베이스 개발/운영 관련 질문과 답변을 올리는 게시판입니다. 궁금하신 내용을 이곳에서 문의하시면 SQLER 분들의 답변을 받으실 수 있습니다. 문의를 하실때에는 최근 작업하신 특이 사항이나, 장애 발생 전 상황을 상세히 올려 주시면 답글을 적어주시는 SQLER분들의 답변이 더 정확할 수 있으니 도움 되시길 바랍니다. 쿼리 문의일 경우, 실제 문제가 재현되는 테이블생성, 샘플데이터 생성 쿼리를 함께 올려 주시면 더 빠르고 정확한 쿼리 문의 응답이 가능합니다.
CREATE PROCEDURE [dbo].usp_labor(
@resource_no nvarchar(20) --품목코드
, @cost_center3 nvarchar(20) --차종
, @date_st datetime --작업 일자
, @date_end datetime --작업 일자
) AS
BEGIN SET NOCOUNT ON;
--exec usp_labor '%','%','2014-02-04','2014-02-04'
select
a.resource_no --품번 //
, sum(a.qty) as qty --작업수량 //
, sum(ch.qty_bad) as qty_bad --불량수량
, p.cost_center1 --사업장
, a.date_worked --작업일자 //
from v_labor_results a --작업실적
join labor_history lh on a.order_no = lh.order_no and a.lot = lh.lot and a.date_worked = lh.date_worked
join procure_det p on a.resource_no = p.resource_no
left join claim_inline_header ch on a.resource_no = ch.resource_no and a.order_no = ch.order_no and a.lot = ch.lot
where( CONVERT(nvarchar(10),lh.date_created, 121) between @date_st and @date_end )
and ( isnull(@resource_no,'%') = '%' or a.resource_no like @resource_no )
and ( isnull(@cost_center3,'%') = '%' or p.cost_center3 like @cost_center3 )
group by a.resource_no, p.cost_center1, a.date_worked
위의 소스에서 계속 a.date_worked 근처 의 구문 이 잘못 되었습니다
문구가 계속 나옵니다.
a.date_worked 을 지우면 p.cost_center1 잘못됐다고 나오는데.. 당최 어느부분이 잘못됐는지 못찾겠네요..
혹시 오류가 보이시는 분이 계신가요
BEGIN SET NOCOUNT ON 블럭의 END 구문이 없어서 발생하는 것으로 보입니다.