{"id":237,"date":"2007-12-30T21:39:36","date_gmt":"2007-12-31T04:39:36","guid":{"rendered":"http:\/\/members.crystalreportsbook.com\/crystal-reports-xi\/1114-sql-expressions-reference\/"},"modified":"2011-10-12T18:19:53","modified_gmt":"2011-10-13T01:19:53","slug":"1114-sql-expressions-reference","status":"publish","type":"post","link":"http:\/\/www.crystalreportsonlinetraining.com\/training\/1114-sql-expressions-reference\/","title":{"rendered":"11.13 SQL Expressions Reference"},"content":{"rendered":"<h2>SQL Expressions<\/h2>\n<p>Throughout this chapter we&#8217;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.<\/p>\n<p><strong>Table 11-2. Converting Crystal functions to SQL functions.<\/strong><\/p>\n<table border=\"1\">\n<tr>\n<th>Crystal Function<\/th>\n<th>Sql Function<\/th>\n<\/tr>\n<tr>\n<td>CStr(), CBool(), CDbl(), CDateTime(), ToNumber(), ToText(), etc.<\/td>\n<td>Convert(,)<\/td>\n<\/tr>\n<tr>\n<td>CurrentDate, CurrentTime(), PrintDate(), PrintTime()<\/td>\n<td>CurDate(), CurTime(), Now()<\/td>\n<\/tr>\n<tr>\n<td>WeekdayName()<\/td>\n<td>DayName()<\/td>\n<\/tr>\n<tr>\n<td>DatePart()<\/td>\n<td>DayOfMonth()<\/td>\n<\/tr>\n<tr>\n<td>DayOfWeek()<\/td>\n<td>DayOfWeek()<\/td>\n<\/tr>\n<tr>\n<td>DatePart()<\/td>\n<td>DayOfYear()<\/td>\n<\/tr>\n<tr>\n<td>Hour()<\/td>\n<td>Hour()<\/td>\n<\/tr>\n<tr>\n<td>Month()<\/td>\n<td>Month()<\/td>\n<\/tr>\n<tr>\n<td>MonthName()<\/td>\n<td>MonthName()<\/td>\n<\/tr>\n<tr>\n<td>DatePart()<\/td>\n<td>Quarter()<\/td>\n<\/tr>\n<tr>\n<td>DatePart()<\/td>\n<td>Second()<\/td>\n<\/tr>\n<tr>\n<td>DatePart()<\/td>\n<td>Week()<\/td>\n<\/tr>\n<tr>\n<td>DatePart()<\/td>\n<td>Year()<\/td>\n<\/tr>\n<tr>\n<td>Abs()<\/td>\n<td>Abs()<\/td>\n<\/tr>\n<tr>\n<td>Cos(), Sin()<\/td>\n<td>ACos(), ASin()<\/td>\n<\/tr>\n<tr>\n<td>Tan(), ATn()<\/td>\n<td>ATan(), ATan2()<\/td>\n<\/tr>\n<tr>\n<td>Ceiling()<\/td>\n<td>Ceiling()<\/td>\n<\/tr>\n<tr>\n<td>Cos()<\/td>\n<td>Cos()<\/td>\n<\/tr>\n<tr>\n<td>Cot()<\/td>\n<td>Degrees()<\/td>\n<\/tr>\n<tr>\n<td>Exp()<\/td>\n<td>Exp()<\/td>\n<\/tr>\n<tr>\n<td>Floor()<\/td>\n<td>Floor()<\/td>\n<\/tr>\n<tr>\n<td>Log()<\/td>\n<td>Log()<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>Log10()<\/td>\n<\/tr>\n<tr>\n<td>Mod<\/td>\n<td>Mod()<\/td>\n<\/tr>\n<tr>\n<td>Pi<\/td>\n<td>PI()<\/td>\n<\/tr>\n<tr>\n<td>^<\/td>\n<td>Power()<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>Radians()<\/td>\n<\/tr>\n<tr>\n<td>Rnd()<\/td>\n<td>Rand()<\/td>\n<\/tr>\n<tr>\n<td>Round()<\/td>\n<td>Round()<\/td>\n<\/tr>\n<tr>\n<td>Sgn()<\/td>\n<td>Sign()<\/td>\n<\/tr>\n<tr>\n<td>Sin()<\/td>\n<td>Sin()<\/td>\n<\/tr>\n<tr>\n<td>Sqrt()<\/td>\n<td>Sqrt()<\/td>\n<\/tr>\n<tr>\n<td>Tan()<\/td>\n<td>Tan()<\/td>\n<\/tr>\n<tr>\n<td>Truncate()<\/td>\n<td>Truncate()<\/td>\n<\/tr>\n<tr>\n<td>AscW()<\/td>\n<td>Ascii()<\/td>\n<\/tr>\n<tr>\n<td>ChrW()<\/td>\n<td>Char()<\/td>\n<\/tr>\n<tr>\n<td>x &amp; y<\/td>\n<td>Concat(), x + y<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>Insert()<\/td>\n<\/tr>\n<tr>\n<td>LowerCase(), LCase()<\/td>\n<td>LCase()<\/td>\n<\/tr>\n<tr>\n<td>Left()<\/td>\n<td>Left()<\/td>\n<\/tr>\n<tr>\n<td>Length()<\/td>\n<td>Length()<\/td>\n<\/tr>\n<tr>\n<td>InStr()<\/td>\n<td>Locate()<\/td>\n<\/tr>\n<tr>\n<td>TrimLeft(), LTrim()<\/td>\n<td>LTrim()<\/td>\n<\/tr>\n<tr>\n<td>ReplicateString()<\/td>\n<td>Repeat()<\/td>\n<\/tr>\n<tr>\n<td>Replace()<\/td>\n<td>Replace()<\/td>\n<\/tr>\n<tr>\n<td>Right()<\/td>\n<td>Right()<\/td>\n<\/tr>\n<tr>\n<td>TrimRight(), RTrim()<\/td>\n<td>RTrim()<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>SoundEx()<\/td>\n<\/tr>\n<tr>\n<td>Space()<\/td>\n<td>Space()<\/td>\n<\/tr>\n<tr>\n<td>Mid()<\/td>\n<td>SubString()<\/td>\n<\/tr>\n<tr>\n<td>UpperCase(), UCase()<\/td>\n<td>UCase()<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>IfNull()<\/td>\n<\/tr>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>SQL Expressions Throughout this chapter we&#8217;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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,1],"tags":[],"class_list":["post-237","post","type-post","status-publish","format-standard","hentry","category-chapter-11-maximizing-sql-performance","category-crystal-reports-xi","entry"],"_links":{"self":[{"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/posts\/237","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/comments?post=237"}],"version-history":[{"count":4,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/posts\/237\/revisions"}],"predecessor-version":[{"id":1911,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/posts\/237\/revisions\/1911"}],"wp:attachment":[{"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/media?parent=237"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/categories?post=237"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/tags?post=237"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}