Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Case trouble for IN subquery

Author  Topic 

bubberz
Constraint Violating Yak Guru

289 Posts

Posted - 2007-03-27 : 10:24:58
I have the following in my WHERE clause for my Sql Server Reporting Services 2000 report (the user can use the parameter @MaxRevs to view all numbers (colNumber) or only the max of colNumbers when grouped by colParentNumber):

AND (tblMain.colNumber IN CASE @MaxRevs WHEN '' THEN '(SELECT colNumber FROM tblMain)' ELSE '(Select max(colNumber) From tblMain Group By [colParentNumber])' END))

I get the following error:
1. ADO error: Syntax error or ADO access error

I've used Case in the past, but it was for a "Like" portion in my WHERE clause.

Thanks!

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-03-27 : 10:28:59
Please restate yor question. What are you trying to accomplish?


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

bubberz
Constraint Violating Yak Guru

289 Posts

Posted - 2007-03-27 : 12:34:48
Hello!

I've posted this in SQL Server and SSRS since I don't really know where specifically the problem is occurring.

The user should be able to use the parameter @MaxRevs to view all data or just the max(colNumber) via the parameter selection.
Go to Top of Page
   

- Advertisement -