Skip to Content
0
Apr 14, 2012 at 01:54 AM

Where Clause in ntext/text datatype

68 Views

hi all,

i have this simple query, not using a variable - this run okey

SELECT T0.[DocNum], T0.[CardCode], T0.[CardName], T1.[ItemCode], T1.[Dscription], T1.[Quantity], T1.[Price], T2.[LineText]FROM OPOR T0  INNER JOIN POR1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN POR10 T2 ON T0.DocEntry = T2.DocEntry WHERE T2.[LineText]  Like '%%TEST%%' 

but when i use the same query but this time i am using a variable, it throws an error

SELECT T0.[DocNum], T0.[CardCode], T0.[CardName], T1.[ItemCode], T1.[Dscription], T1.[Quantity], T1.[Price], T2.[LineText]FROM OPOR T0  INNER JOIN POR1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN POR10 T2 ON T0.DocEntry = T2.DocEntry WHERE T2.[LineText]  Like '%%[%0]%%' 

how you do it? pls help

regards,

Fidel