Hi
I need to write a query for a customer. The query works fine, but we need to send four variables through to four parameters. For some strange reason i can only send two variables through at a time. Al though all four variable query statements works independtly. I have tested this SQL query in Query Analyzer and it works fine. Can you please help me with this error. Here's the part of the query that i need to accept the variables.
BEGIN
DECLARE
@A VAR @B VAR, @C VAR, @D VAR
SET
@A = (SELECT DISTINCT T0.DocDate FROM OINV T0 WHERE T0.DocDate = '[%1]'),
@B = (SELECT DISTINCT T0.DocDate FROM OINV T0 WHERE T0.DocDate = '[%2]'),
@C = (SELECT DISTINCT T1.ITMSGRPNAM FROM OITB T1 WHERE T1.ITMSGRPNAM ='[%3]'),
@D = (SELECT DISTINCT T1.ITMSGRPNAM FROM OITB T1 WHERE T1.ITMSGRPNAM ='[%4]')
END
The reason why i want to do it this way, is because the main query have lot of joins, unions and nested Selects and SAP doesn't want to allow the use of this methods with "SAP" variables.