Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add Parameter to SQL 1

Status
Not open for further replies.

bobpyle

Technical User
Apr 6, 2003
5
AU
How do I add a parameter created in Crystal Reports 8.5 to the SQL from 'Show SQL Query' under Database. If I add {?Test} to restrict records I receive several errors.

Regards,

Bob
 
Add the parameter to your record selection formula instead, as in:

{table.date} = {?dateparm}

Go to report->edit selection formula->record. If set up correctly in the record selection formula, the parameter should then appear in the Show SQL query.

-LB
 
lbass,

Any parameters used in the record selection formula do not appear in the Show SQL query. And here lies the problem. I am try to reduce the number of records presented to Crystal to reduce the time the report takes to run.

Regards,

Bob
 
I disagree. If you design the record selection formula correctly, the results of the parameter selection will appear in the where clause of the SQL query. The parameter selection is made before the SQL statement is generated, so if you selected "TestA" from the parameter list and you had a record selection formula of:

{?test} = {table.test}

...then the where clause would include a where clause like:

WHERE
Table.`Test` = 'TestA'

You might want to check out SynapseVampire's FAQ767-3825 on optimizing SQL pass-through.

-LB
 
lbass,

Thanks for your helpful information.

Regards,

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top