Using Same Query | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Using Same Query

Is there a way to write and save a query and then use in various reports.
The manual method of cut and paste is an option but would think that
being able to use the same query across several reports would also
be an option. Thanxs,
If you are using SQL then stored procedures or views allow this modularisation/reuse of code (assuming that you are querying the same database). I’m not aware of anything specifically in RS for this however you can create a report template containing in your common query and then copy the resultant RDL file from your project folder to (by default) C:program FilesMicrosoft SQL Server80ToolsReport DesignerProjectItemsReportProject. This means that when you create a new Report Project, the template report will be available when you choose Reports>Add New Item
HTH Jasper Smith
Jasper,<br /><br />How could a stored procedure be referenced from the RS interface? <br />As for the template information, it solves another problem for me. <br /><br />Thanxs,<br />dmatta<br />[<img src=’/community/emoticons/emotion-2.gif’ alt=’:D‘ />]
Simply edit the dataset and change the command type to Stored Procedure then type the procedure name into the query string box. It will work out the parameters and if you run the procedure, prompt you for values. Not sure if this is what you were asking ? HTH Jasper Smith
This answers the question for me…. Thanks!
dmatta59 P.S. It just sunk in… duhhhhh!