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
/*************************************************
* 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