Crystal Reports and Queries
-
I have a report in Crystal that gets data from SQL queries and it's slow. How do I use a stored procedure to make the report access data faster?
-
I have a report in Crystal that gets data from SQL queries and it's slow. How do I use a stored procedure to make the report access data faster?
Create the stored procedure to return the data from the query that you are using. CREATE PROCEDURE [dbo].[MySelectProcedure] @Parm1 int AS SELECT * FROM MainTable MT LEFT JOIN MyOtherTable OT ON MT.KeyField1 = OT.KeyField1 WHERE MT.MyParmField = @Parm1 Add parameters if you need them. When you are defining a new report in Crystal, you can select a stored procedure exactly like selecting a table. Add your stored procedure as the datasource. If you used parameters in it, they will show up in your parameters list in the report. Well written stored procedures are absolutely the BEST datasource that you can use for a Crystal Report.
Tom Garth Developer R. L. Nelson and Associates, Inc., Virginia