Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: SQL Expression Error Post Reply Post New Topic
Author Message
garylythgoe
Newbie
Newbie
Avatar

Joined: 01 Feb 2008
Online Status: Offline
Posts: 5
Quote garylythgoe Replybullet Topic: SQL Expression Error
     Posted: 24 Apr 2008 at 6:10am
Not too familiar with Crystal, but am with SQL.
 
Trying to create a SQL expression, using this syntax:
 
(
select lc_title
from lc_agreement
where {SUBSTRING("lc_agreement_rule_value"."lc_value",65 ,36 )} = {SUBSTRING("im_incident_category"."im_guid",2 ,36 )}
)
 
 
Cant see anything wrong with it myself CryLOL
 
Its erroring, and i cant work out why!!!
 
Any idea's? Star#
 
Many thanks,
 
Gary
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 24 Apr 2008 at 6:48pm
I'm confused. Is this a SQL Expression (a formula that gets passed to SQL) or the SQL Command Ojbect (a custom SQL query that CR uses to retrieve data). If this is a SQL Expression, then it's all wrong because you build an entire SQL statement here. But this would be perfect as a SQL Command Object.

A SQL Expression shouldn't have the SELECT clause in it. Crystal takes a SQL Expression and inserts it into the report's existing query. Thus, the SELECT is already there and the Expression is just another field to return.

I have extensive coverage about custom SQL queries, SQL Expressions and optimizing database access in Chapters 10 and 11 of my Encyclopedia book. You can find out more about my books at Amazon.com or reading the Crystal Reports eBooks online.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
garylythgoe
Newbie
Newbie
Avatar

Joined: 01 Feb 2008
Online Status: Offline
Posts: 5
Quote garylythgoe Replybullet Posted: 25 Apr 2008 at 3:31am
Originally posted by BrianBischof

I'm confused. Is this a SQL Expression (a formula that gets passed to SQL) or the SQL Command Ojbect (a custom SQL query that CR uses to retrieve data). If this is a SQL Expression, then it's all wrong because you build an entire SQL statement here. But this would be perfect as a SQL Command Object.

A SQL Expression shouldn't have the SELECT clause in it. Crystal takes a SQL Expression and inserts it into the report's existing query. Thus, the SELECT is already there and the Expression is just another field to return.

I have extensive coverage about custom SQL queries, SQL Expressions and optimizing database access in Chapters 10 and 11 of my Encyclopedia book. You can find out more about my books at Amazon.com or reading the Crystal Reports eBooks online.
 
Brian, many thanks for your links, the ebooks look absolutely brilliant! Congratulations on some brilliant writing!
 
I know realise i need to create a SQL Command Object, but cannot see the functionality available in my Crystal Reports XI ?
 
Again, apologies for my lack of knowledge!
 
Regards,
 
Gary!
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum