cancel
Showing results for 
Search instead for 
Did you mean: 

Display Parameters in Query results.

Former Member
0 Kudos

I would like to display the Parameters in the Query results. Is it possible?

Here is the Query, it gives errors.

SELECT 'Searched for' as 'Search', '[%0' as 'Input', T1.ItemCode, T1.Dscription, T1.Quantity, T1.OpenQty, T1.ShipDate, T0.DocNum, T1.LineNum,T0.CardCode, T0.CardName,T1.WhsCode, T1.LineStatus, T1.PickStatus, T1.PickIdNo FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry WHERE (T1.Dscription Like '%[%0] %'

OR T1.Dscription LIKE '[%0]%'

OR T1.Dscription LIKE '%[%0]') and '[%0]' != '' and T1.LineStatus='[%1]'

Edited by: M. Jenkins on Jul 30, 2010 6:47 PM

Accepted Solutions (1)

Accepted Solutions (1)

former_member204969
Active Contributor
0 Kudos

Try this one:

declare @c nvarchar(100)
declare @s char(1)
/*select T.Item from rdr1 t
 where T.Dscription Like '%[%0]%' and T.LineStatus='[%1]'*/
set @c='[%0]'
set @s='[%1]'
SELECT 'Searched for' as 'Search',@c as Input, T1.ItemCode, T1.Dscription,
 T1.Quantity, T1.OpenQty, T1.ShipDate,
 T0.DocNum, T1.LineNum,T0.CardCode, T0.CardName,
T1.WhsCode, T1.LineStatus, T1.PickStatus, T1.PickIdNo 
FROM ORDR T0
 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry 
WHERE T1.Dscription Like '%'+@c+'%' and @c != '' and T1.LineStatus= @s

Answers (1)

Answers (1)

Former Member
0 Kudos

Your condition is actually equivalent to:

WHERE T1.Dscription Like '%[%0\] %' and '[%0\]' != '' and T1.LineStatus='[%1\]'

Thanks,

Gordon