Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 170: Incorrect syntax near '('

Status
Not open for further replies.

WordTechinc

Programmer
Sep 4, 2009
38
Please advise me for this error.

This is SQL statement:

Create table #LicDel (id bigint identity,liccd numeric (18),profcd nvarchar(8))
 
Code:
Create table #LicDel (id bigint identity (1,1),
                      liccd numeric (18),
                      profcd nvarchar(8))

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
I still get Error 170: Incorrect syntax near '('.
This is full PROC.

ALTER proc [dbo].[INRv2_GetNthReduction_WORK] @Jobcd varchar(10),@profcd varchar(8000)
as
Begin
set nocount on
declare @icnt int
set @icnt = 0

Declare @Reduction table (pfcd nvarchar(8),incrval int, ActCnt int)
declare @Liccode table (liccd numeric (18),profcd nvarchar(8))


Create table #LicDel (id bigint identity,liccd numeric(18),profcd nvarchar(8))

if (@profcd <> 'Nil')
begin
exec sp_xml_preparedocument @icnt OUTPUT, @profcd
Insert into @Reduction
select Pcd,incVal,ActCnt from openxml(@icnt,'/Root/Pfcd',1) WITH (Pcd nvarchar(8),incVal int, ActCnt int)
exec sp_xml_removedocument @icnt
end
Insert into @Liccode
select [Unique id],Profcode from INR_MailingList where Jobno=@Jobcd and Type='L'
order by Profcode

declare @pdfCd nvarchar(8)
declare @intCrVal int
declare @ActCnt int
Declare @DelRec int
Declare @Cnt int
set @Cnt = 1
set @DelRec = 0

Declare curDel cursor for Select pfcd,incrval,ActCnt from @Reduction
open curDel
fetch next from curDel into @pdfCd,@intCrVal,@ActCnt
while @@fetch_status = 0
Begin
Insert into #LicDel select * from @Liccode where profcd = @pdfCd
While (@Cnt <= @ActCnt)
begin
set @DelRec = @DelRec + @intCrVal
delete from #LicDel where id = @DelRec
set @Cnt = @Cnt + 1
end
delete from @Liccode where profcd = @pdfCd
Insert into @Liccode select liccd,profcd from #LicDel
truncate table #LicDel
set @DelRec = 0
set @Cnt = 1
fetch next from curDel into @pdfCd,@intCrVal,@ActCnt
End
close curDel
deallocate curDel
drop table #LicDel



select [First name]+' '+[Last name] NAME,Company_Name COMPANY,Contact_Title TITLE,[Address 1] ADDR1,[Address 2] ADDR2,[Address 3] ADDR3,
[Address 4] ADDR4, City CITY,State STATE,[5 digit zip] ZIP,[last four digits of zip (after the -)] [ZIP + 4],
[Delivery Point Barcode] DPBC,[Check Digit] CHECKDIGIT,@Jobcd as JOBNO,[Unique ID] LICENSE_ID,StudentID STUDENT_ID,
C.profcd PROF_CODE from INR_MailingList A

inner join @Liccode C on C.liccd = A.[Unique ID] and C.profcd = A.ProfCode and Type = 'L' and JobNo = @Jobcd
order by C.profcd



end
GO
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top