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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variables in MS/SQL vs CR/SQL

Status
Not open for further replies.

abds

Programmer
Dec 13, 2000
46
US
In MS/SQL I can do

declare @START_DATE datetime
@START_DATE = '2/17/02'
...
where MY_TABLE.ANY_DATE >= @START_DATE ...

This doesn't seem to work in CR/SQL. What can I do instead?
Is this a general problem with variables, or only with dates?
 
try create a date parameter and in the select expert you just have to compared the date field with the parameter.

{table.Start_date} >= {?somedate}
 
I don't need parameters (I think). I have a very long query with 8 unions and I just want to set a variable at the top instead of hunting through the whole query.
I tried doing

{?START_DATE} = '02/02/02'

and it didn't work.
 
First, there is no such thing as CR/SQL. CR generates SQL based on the database you are connecting to.

Are you in the 'show SQL' window of the Report designer? There are several limitations on what you can do in that window. You can't do anything in the SELECT clause, and I would guess that would include anything ABOVE that statement. It may not be accepted anywhere.

In the SQL designer you should be able to enter any valid SQL statement. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top