cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
537
Views
0
Helpful
2
Replies

UCCX SQL query assistance needed.

rastetterj
Level 1
Level 1

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
Level 4
Level 4

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