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

Crystal Command Parameter (String) only works with numbers not lettters

Status
Not open for further replies.

BandOQ4b

Programmer
Jul 22, 2010
19
US
Below is a simplified version of the command I wrote. If I enter numbers for the sting parameters it works fine, when I enter letters it fails and gives an "invalid column name" showing the sting (ie. 'ABC') I have created other reports with date, number, and sting parameters, they work fine. I am using Crystal Reports 2008 version 12.2.2.453 I have tired the same thing on a second PC with the same software with the same results. Also if "hard coded" with a sting value, in place of the command parameter it works fine. A solution would be greatly appreciated!!

/*************************************************
* Internal Variables (within Command)
*************************************************/

DECLARE
@Debug INT = 0
,@USER_INFO VARCHAR(25) = NULL

/*************************************************
* Variables tied to command parameters
*************************************************/

DECLARE
@LAST_NM VARCHAR(16) = NULL
,@FIRST_NM VARCHAR(11) = NULL
,@USER_ID NVARCHAR(10) = NULL
,@ROLE INT = 0

/************************************************
* Section Only Used in Crystal Command
*************************************************/

SET @LAST_NM = {?Last_Name}; -- String in command parameter
SET @FIRST_NM = {?First_Name}; -- String in command parameter
SET @USER_ID = {?User_Id}; -- String in command parameter
SET @ROLE = {?Role}; -- Number in command parameter


SELECT
@LAST_NM as Last_Name
,@FIRST_NM as First_Name
,@USER_ID as User_Ident
,@ROLE as User_Role
,@USER_INFO as User_Infor
,SBU_CODE as Single_Business_Unit
FROM
UTILITY.SBU
 
Not sure this helps, but string parameters in commands must have single quotes around them, as in:

"table"."string"='{?StringParameter}'

-LB
 
Thanks!!!!!!
That worked, I knew it had to be something simple, I just couldn't see it!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top