Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Variable in query

Hello,

I want to create a complex query with the Query generator and in a Note I found that is is recommended to declare variables.

I tried to use this example for a query but this doesn't work. What's wrong? Does anyone have a working example?

/SELECT FROM [dbo].[OITM] T0/

declare @art as string

/* WHERE */

set @art = /* T0.Itemcode */ '[%0]'

SELECT T1.Itemcode FROM OITM T1 where T1.Itemcode = @art

regards,

John

Former Member
Former Member replied

You should use varchar instead of string:

declare @art as varchar(20)

Then it works!

Regards,

Jacco

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question