cancel
Showing results for 
Search instead for 
Did you mean: 

how to query text UDF data?

Former Member
0 Kudos

I have a query that contains a text UDF, where I need to search for a string that the user enters, see example below:

SELECT t0.docnum, t0.cardname, t0.cntctcode, t0.docdate, t0.u_salescomments, t0.u_generalnotes, t0.u_salesrepcodes, t1.dscription, t1.price, t1.u_custpartno, t1.u_salescomments FROM OQUT t0, QUT1 t1 WHERE t0.docentry = t1.docentry AND t0.u_cr1flag = 'QUOTE' AND t1.dscription = [%0] OR t1.u_custpartno = [%1] OR t0.cardname = [%2] OR t0.cntctcode = [%3] OR t0.u_salesrepcodes = [%4] OR CONTAINS(t0.u_salescomments, '%%[%5]%%')

The issue is the last variable for u_salescomments, where I want to search for a user entered string in the text contained within this field.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Try this one:


SELECT t0.docnum, t0.cardname, t0.cntctcode, t0.docdate, t0.u_salescomments, t0.u_generalnotes, 
t0.u_salesrepcodes, t1.dscription, t1.price, t1.u_custpartno, t1.u_salescomments
FROM dbo.OQUT t0
INNER JOIN  dbo.QUT1 t1 ON t0.docentry = t1.docentry 
WHERE t0.u_cr1flag = 'QUOTE' AND t1.dscription = [%0] OR t1.u_custpartno = [%1] OR t0.cardname = [%2] 
OR t0.cntctcode = [%3] OR t0.u_salesrepcodes = [%4] OR t0.u_salescomments like '%[%5]%'

Thanks

Gordon

Answers (0)