Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

11.13 SQL Expressions Reference

SQL Expressions

Throughout this chapter we’ve discussed the different parts of a report that can be improved with SQL Expressions. The following table lists the different Crystal functions and their SQL Server equivalents. Although other databases are certain to have slight variations with their functions, they should be similar. You should consult your SQL documentation for the exact syntax of each function.

Table 11-2. Converting Crystal functions to SQL functions.

Crystal Function Sql Function
CStr(), CBool(), CDbl(), CDateTime(), ToNumber(), ToText(), etc. Convert(,)
CurrentDate, CurrentTime(), PrintDate(), PrintTime() CurDate(), CurTime(), Now()
WeekdayName() DayName()
DatePart() DayOfMonth()
DayOfWeek() DayOfWeek()
DatePart() DayOfYear()
Hour() Hour()
Month() Month()
MonthName() MonthName()
DatePart() Quarter()
DatePart() Second()
DatePart() Week()
DatePart() Year()
Abs() Abs()
Cos(), Sin() ACos(), ASin()
Tan(), ATn() ATan(), ATan2()
Ceiling() Ceiling()
Cos() Cos()
Cot() Degrees()
Exp() Exp()
Floor() Floor()
Log() Log()
Log10()
Mod Mod()
Pi PI()
^ Power()
Radians()
Rnd() Rand()
Round() Round()
Sgn() Sign()
Sin() Sin()
Sqrt() Sqrt()
Tan() Tan()
Truncate() Truncate()
AscW() Ascii()
ChrW() Char()
x & y Concat(), x + y
Insert()
LowerCase(), LCase() LCase()
Left() Left()
Length() Length()
InStr() Locate()
TrimLeft(), LTrim() LTrim()
ReplicateString() Repeat()
Replace() Replace()
Right() Right()
TrimRight(), RTrim() RTrim()
SoundEx()
Space() Space()
Mid() SubString()
UpperCase(), UCase() UCase()
IfNull()