Avatar of royjayd
royjayd
 asked on

Incorrect syntax near '?'.

Dear experts
 I am using this sql (our database is Ms SQL Server 2008 and we have defined our sql in a spring xm file)
 
select distinct cg.NAME as CustomerGroup,COUNT(cg.NAME) as GroupCount		 
		 FROM PAC.CustomerGroupMap cgmap,
		 PAC.CustomerGroup cg,			
		 PAC.Customer Customer,
		 PAC.Customercluster customerRef
		 where cg.CustomerGROUPID = cgmap.CustomerGROUPID and
		 cgmap.CustomerID = Customer.CustomerID 
		 and customerRef.CustomerGROUPID = cgmap.CustomerGROUPID
		 and (customerRef.MODIFIEDBY != 'Migration' OR customerRef.ISACTIVE != 'F')
		 and customerRef.CLUSTERID = ?
		group by cg.NAME		
		having COUNT(cg.NAME) = 1

Open in new window

           
            But it gives this exception
                  ]; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near '?'.
                  
                  the parameter passed is a number like 100, 200, ect.
                  Any clue where the problem is.
                  
                  Thanks.
Microsoft SQL Server 2008

Avatar of undefined
Last Comment
royjayd

8/22/2022 - Mon
SOLUTION
Robberbaron (robr)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
PortletPaul

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
royjayd

ASKER
right on. thanks.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23