We help IT Professionals succeed at work.

SQL Expressions and Parameters

mattkovo asked
Medium Priority
Last Modified: 2012-06-27
I am using Crystal 2008

I want to be able to use a parameter from the report for my dates in the SQL Expression. I've looked around and I understand this is not possible still? Do I need to create a Stored Procedure on the database first? Can I then send the parameters over to the Stored Procedure?

Here is my SQL Expression and I would like to use the parameters {?StartDate} and {?EndDate}.  Any help would be appreciated!

SELECT count (Record_Number)
  FROM [MyFocusPOS].[dbo].[CHECK]
  where storeid = '4'
  and check_file_date > '2/5/2009' and
  check_file_date < '2/9/2009'
  and flag_used is null
  and all_seats_voided is null
Watch Question

Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013

You could use a subreport to get the value and display it or pass it back in a shared variable.

1.  add check_file_date as a field in your SELECT Statement.
2.  in Report/Selection Formulas/Record.... say
     check_file_date >= {?StartDate}  and
     check_file_date <= {?EndDate}

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.