cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

340
Views
0
Helpful
2
Replies
rastetterj
Beginner

UCCX SQL query assistance needed.

Hello,

 

I am working on a SQL query that does a lookup of the calling number and the last four digits entered by the customer.  If I hard code the lastFourGC variable I am able to return a successful result.  If I use $lastFourGC I get the following error.

 

$callingNumber  - Is exactly that, the calling number.

$lastFourGC - Is the last four digits collected from the customer.

 

SELECT * FROM GiftCardFulfillment WHERE Phone=$callingNumber and Right (GiftCard16DigitNumber, 4)=$lastFourGC

 

 

 

2 REPLIES 2
Tanner Ezell
Enthusiast

You need to encapsulate the string variable with quotes. Try the following:

 

SELECT * FROM GiftCardFulfillment WHERE Phone=$callingNumber and Right (GiftCard16DigitNumber, 4)='$lastFourGC'
Tanner Ezell www.ctilogic.com

Tanner,

 

I had tried that with single and double quotes and it didn't work.  I did end up getting it to work by rearranging the order.  I'm not sure why that worked, but this is what the query looks like now and it works.

 

SELECT * FROM [leads].[dbo].[GiftCardFulfillment]   

         WHERE Right (GiftCard16DigitNumber, 4)=$lastFourGC and Phone=$callingNumber

Content for Community-Ad