Simulate Parameters in an SQL Pass-Through Query

CoffeeGuru

Registered User.
Local time
Today, 23:37
Joined
Jun 20, 2013
Messages
121
I have an Access pass-through query that selects the top 10.

I need to be able to allow a user to select the top x

How do I pass x as a parameter to SQL Server by embedding it into my Pass-through query.

this is my code

Code:
SELECT TOP 10 Country
               ,Retailer
               ,[Store Number]
               ,[Store Location]
               ,sum(Revenue) AS Revenue
               ,(SELECT sum([revenue]) FROM #SalesData52) AS Total_revenue
               ,sum([Revenue])/(SELECT sum([revenue]) FROM #SalesData52) AS [Rev%]
             
from #salesdata52
 
GROUP BY Country
               ,Retailer
               ,[Store Number]
               ,[Store Location]
  
 ORDER BY Sum([Revenue])  DESC
 
Where is the rest of the code? Is this part of a sub or function?
 
Hi ya

That is the whole thing

I need to amend it (in access) to pick up a user entered variable/parameter from somewhere (possibly a text box) so that it reads

Select Top (@Parm) .......

Martin
 

Users who are viewing this thread

Back
Top Bottom