im getting an error on the With Dups portion of the code.
With Dups as
(
????select *, row_number() over
(partition by Product_Code order by Product_Code) as RowNum
????from #prod
)
Msg 102, Level 15, State 1, Line 3
Incorrect syntax near '?'.
Msg 102, Level 15, State 1, Line 5
Incorrect syntax near '?'.