Solved

Parameter for a Database COMMAND?

Posted on 2006-06-30
2
264 Views
Last Modified: 2012-06-21
I'm using this SQL Command at the Database Command line level and I would like to have the ability in CR XI to input/change the DATE within the Crystal Report...instead of having to go to the Command Line here and change it. I "think" I need to use a parameter but not sure how.

How can I have the DATE of 06-30-2006 00:00:00 changed to where I use the SELECT CRITERIA in Crystal to change the date for the report run...THANKS
Mike



declare @HistDate datetime
set @HistDate = '06-30-2006 00:00:00'  --<<<--- Type in the Historical Unit DATE that you wish to use HERE
SELECT *
FROM (
select ( dbo.gethistoricalunit(dbo.bkcyacct.[file number],@HistDate)) as [HistUnit],*
from dbo.bkcyacct
where [system closed date] is null
or [system closed date] > @HistDate
and [file open date] <= @HistDate
 )A

WHERE A.[HistUnit] is  not null
--and [file number] not like 'Z%'
and [file number] not like '99%'
and [file number] not like '1001%'

0
Comment
Question by:MIKE
2 Comments
 
LVL 42

Accepted Solution

by:
frodoman earned 500 total points
ID: 17019473
declare @HistDate datetime                  --<<<--- don't need
set @HistDate = '06-30-2006 00:00:00'  --<<<--- don't need

SELECT *
FROM (
select ( dbo.gethistoricalunit(dbo.bkcyacct.[file number],{?HistDate})) as [HistUnit],*
from dbo.bkcyacct
where [system closed date] is null
or [system closed date] > {?HistDate}
and [file open date] <= {?HistDate}
 )A


In the above, "HistDate" is your date parameter in Crystal.  Format your SQL as shown above to compare to the date parameter.
0
 
LVL 17

Author Comment

by:MIKE
ID: 17019480
Got it working...THANKS
M
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now