Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: SQL Command Parameter Post Reply Post New Topic
Author Message
AndrewZ00
Newbie
Newbie


Joined: 23 Apr 2009
Location: United States
Online Status: Offline
Posts: 4
Quote AndrewZ00 Replybullet Topic: SQL Command Parameter
    Posted: 23 Apr 2009 at 8:17am
i have dumped all my sql into a command... works great but i want to be able to use parameters...
 
i have created startDate, EndDate, Recruiter, and OrgCenter
 
the dates work fine..
[DateField] between {?StartDate} and {?EndDate}
 
however im having issues when i try to use the LIKE command...
 
[RecruiterIDField] like {?Recruiter}
 
both are strings... any suggestions?
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 23 Apr 2009 at 9:11am
Like usually has parentheses.  If the parameter is a single value, use =, if there are multiple values separated by commas may not work as the parameter is really not formatted for a like.
 
You might want to use whatever is similar to CHARINDEX...namely is the id in the parameter (make sure that you check for uniqueness)
IP IP Logged
AndrewZ00
Newbie
Newbie


Joined: 23 Apr 2009
Location: United States
Online Status: Offline
Posts: 4
Quote AndrewZ00 Replybullet Posted: 23 Apr 2009 at 10:22am

the goal here is to be able to select a single persons record or ALL records...

the parameter could be set..

{?Recruiter} = 29122 (a recruiter ID)

or {?Recruiter} like '%'

IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 23 Apr 2009 at 1:32pm

well you could try adding single quotes around the {?Recruiter} something like

RecruiterIDField] like '+{?Recruiter}+'
 
but there will need to be multiple single quotes to signify the actual single quote you would type in a sql command.
 
I am not a pro at the command sql, since I use stored procs to retrieve all data for reports.
 
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.