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 구문이 없어서 발생하는 것으로 보입니다.