HI there, Using iReports I've created a report. I'll first explain why I need the query: A user often has multiple selection criteria. For instance a user likes to see all his open documents (easy), now he wants to only see the documents that are addressed to 5 specific persons. The database often has tens of thousands persons. The query now will be (simplified): SELECT * FROM documents WHERE addressedto IN (1,2,3) AND user = 2 But when the user likes to see all documents our program can supply a long string containing ALL 'addressedto' ID's. as you'll understand this probibly ain't the best way. It also can supply a string like "ALL" So with some help the following query was created: DECLARE @a VARCHAR(4) SET @a = 'ALL' SELECT * FROM verrichting WHERE typeID = (CASE WHEN @a <> 'ALL' THEN CASE WHEN typeID IN (@a) THEN typeID ELSE NULL END ELSE typeID END) AND user != 2 This query works, if I replace ALL with 8,11, I'll only find the types '8,11' Now i'm using the folling query in ireport: CREATE TABLE #documents (addressedto INT) INSERT INTO #documents VALUES(1) INSERT INTO #documents VALUES(2) INSERT INTO #documents VALUES(3) INSERT INTO #documents VALUES(4) DECLARE @a VARCHAR(4) SET @a = $P!{TYPE} SELECT * FROM #documents WHERE addressedto = (CASE WHEN @a <> 'ALL' THEN CASE WHEN addressedto IN (@a) THEN addressedto ELSE NULL END ELSE addressedto END) DROP TABLE #documents $P!{TYPE} is a string with default value "'ALL'" ("ALL" doesn't work) case 1: If I enter "ALL" everything works case 2: if I enter 1, only 1 is displayed (also correct) case 3: if I enter 1,2 an error occurs case 3 should work (as it does with query browsers) It would even be better if I could replace the @a with the iReport variable, but this also gives errors... I've attached a ireport and Jasper file for testing purposes. (And I assume this is a jasper report error, not A iReport error) Code:Error filling print... Error executing SQL statement for : report1 net.sf.jasperreports.engine.JRException: Error executing SQL statement for : report1     at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(JRJdbcQueryExecuter.java:143)     at net.sf.jasperreports.engine.fill.JRFillDataset.createQueryDatasource(JRFillDataset.java:686)     at net.sf.jasperreports.engine.fill.JRFillDataset.initDatasource(JRFillDataset.java:606)     at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:1277)     at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:892)     at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:841)     at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:58)     at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417)     at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:247)     at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:877)     at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)     at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997) Caused by: java.sql.SQLException: Incorrect syntax near ','.     at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:364)     at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2754)     at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2195)     at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:620)     at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:372)     at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:672)     at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(JRJdbcQueryExecuter.java:137)     ... 11 more Print not filled. Try to use an EmptyDataSource...