Link to home
Start Free TrialLog in
Avatar of Jay Roy
Jay RoyFlag for United States of America

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.
SOLUTION
Avatar of Robberbaron (robr)
Robberbaron (robr)
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jay Roy

ASKER

right on. thanks.