I don't know if you already solved this problem, but if the others will have the same problem:
If you are using a stored procedure, first you can declare a variable and than use set command to set the value of that variable and then use it in the following code:
DECLARE @idactual int
SET...
Hello, I did not see any problem on the code that you wrote except that there is missing something that specifies on what fields are you performing the join. So after:
INNER JOIN ProdHeader
just include: ON
I hope this will work.