Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 28687

Need to Create a Parameter in a subquery

$
0
0

I'm using SSRS 2008 and I have a report with a subquery that contains a parameter, @LocationNo. what I'm trying to do is allow a user to enter a Location Number, which is a five digit integer, and have the sub query send a value called CustomerKey back to the outer query. If I hard code a value into the subquery this works fine. When I put this into a report and try to create a parameter the report is blank. Example code is below:

SELECT X
, Y
, Z
FROM SomeTable ST
JOIN SomeOtherTable SOT  . . . 
WHERE SOT.Customer_KEY IN
    SELECT c.Customer_Key
    FROM Customers c
    WHERE c.Number IN(
        SELECT * FROM OPENQUERY(DATABASE2, 
        'SELECT TOP 1 cu.Number FROM CUSTOMER CU INNER JOIN ATable A on A.Number = cu.Number WHERE SUBSTRING (cu.CustomerID, 3,5) = ''@LocationNo'')))
What am I doing wrong? There has to be a way to create a parameter for LocationNo.

Lee Markum


Viewing all articles
Browse latest Browse all 28687


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>