I am altering a stored procedure, and when I try to excecute, I get:
Msg 156, Level 15, State 1, Procedure vtg_asmbltimephasedashassy, Line 20
Incorrect syntax near the keyword 'AS'
But when I go to line 20, there is no keyword ‘as’, nor is it in the line directly before or after line 20. Maybe I am counting the lines wrong.
When I am counting to line 20 I get the line that reads
jobmtl.partnum=partwhse.partnum FULL OUTER JOIN
Could anyone point me in the right direction as what I need to do to resolve the issue? My enitre stored procedure follows below.
USE [mfgsys803]
GO
/****** Object: StoredProcedure [dbo].[vtg_asmbltimephasedashassy] Script Date: 01/08/2013 12:59:18 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER proc [dbo].[vtg_asmbltimephasedashassy] @p_plant varchar(max)
as
begin
set nocount on;
SELECT jobhead.jobnum, sum(partwhse.onhandqty) as 'onhandqty', jobhead.partnum, jobhead.revisionnum, jobhead.prodqty, jobhead.startdate, jobhead.duedate, jobhead.reqduedate,
jobhead.commenttext, jobmtl.issuedcomplete, jobmtl.issuedqty, jobmtl.mtlseq, jobmtl.partnum AS 'mtlpart', jobmtl.requiredqty, jobmtl.qtyper, jobmtl.reqdate,
partwhse.warehousecode, prodgrup.description
FROM jobmtl LEFT OUTER JOIN
partwhse INNER JOIN
warehse ON partwhse.company = warehse.company AND partwhse.warehousecode = warehse.warehousecode ON jobmtl.company = partwhse.company AND
jobmtl.partnum = partwhse.partnum FULL OUTER JOIN
prodgrup INNER JOIN
jobhead ON prodgrup.company = jobhead.company AND prodgrup.prodcode = jobhead.prodcode ON jobmtl.company = jobhead.company AND
jobmtl.jobnum = jobhead.jobnum
WHERE (jobhead.jobreleased = 0) AND (jobhead.jobfirm = 1) AND (jobhead.jobengineered = 1) AND (jobhead.company = 'lot') and (prodgrup.description like '%assy%') and (jobhead.plant=@p_plant) and (warehse.plant=@p_plant)
group by jobhead.jobnum, jobhead.partnum, jobhead.revisionnum, jobhead.prodqty, jobhead.startdate, jobhead.duedate, jobhead.reqduedate,
jobhead.commenttext, jobmtl.issuedcomplete, jobmtl.issuedqty, jobmtl.mtlseq, jobmtl.partnum AS 'mtlpart', jobmtl.requiredqty, jobmtl.qtyper, jobmtl.reqdate,
partwhse.warehousecode, prodgrup.description
end
take this part out of the group by
make it