Wednesday, November 21, 2007

SQL:creating a parameterized report

My Computer Name is Vision. The default SQL Server is installed.
Business Intelligence Development Studio
New Project --Report Server Project Wizard


SELECT FirstName, LastName, e.Title
FROM HumanResources.Employee AS e
JOIN Person.Contact AS c
ON e.ContactID = c.ContactID
WHERE e.Title IN (@Title)

Click on Layout tab
Report Menu--Report Parameters
Because the query has a parameter (@Title), the report automatically includes it. Configuring the parameter as the follows:


Multi-value --checked


Non-Query--checked with 3 static values: Design Engineer, Accountant, and Marketing Assistant.


Deploy the report;


=================


Available value From query


Create a new dataset called title with statement "SELECT DISTINCT title FROM HumanResources.Employee":

Click on Layout tab, Report Menu--Report Parameters, this time select FROM QUERY with dataset:TitleDeploy the report;


Click the View Report button;